A nexus of contracts theory of legal entities