
637 N.W.2d 142 (2001)
STATE of Iowa, DEPARTMENT OF HUMAN SERVICES, ex rel. Charles M. PALMER, Director, Plaintiff,
v.
UNISYS CORPORATION and Paramax Systems Corporation, A Unisys Company, Defendants.
Unisys Corporation, Appellant,
v.
Lewin-VHI, INC., n/k/a LWVHI, Inc., Defendant,
Heritage National Health Plan and Care Choices, Inc., Appellees.
No. 99-1535.
Supreme Court of Iowa.
December 19, 2001.
*147 Mark McCormick, Mark E. Weinhardt, Margaret C. Callahan, and Danielle M. Shelton of Belin Lamson McCormick Zumbach Flynn, P.C., Des Moines, for appellant.
David Swinton of Ahlers, Cooney, Dorweiler, Haynie, Smith & Allbee, P.C., Des Moines, for appellee Heritage National Health Plan.
Richard R. Chabot and Jill Mataya Corry of Sullivan & Ward, P.C., Des Moines, for appellee Care Choices.
CADY, Justice.
Unisys Corporation appeals from an order by the district court dismissing its claims for unjust enrichment and contribution. We reverse the decision of the district court, and remand the case for further proceedings.

I. Background Facts and Proceedings.
This action originated when the State of Iowa sued Unisys Corporation and a subsidiary corporation named Paramax Systems Corporation for breach of contract and breach of implied warranty in connection with its management of the state and federal Medicaid program in Iowa. Unisys filed a cross-petition against Heritage National Health Plan and Care Choices, Inc. for contribution, indemnity, and unjust enrichment. Heritage and Care Choices moved for summary judgment and the facts and circumstances presented during the course of the summary adjudication proceedings that followed form the basis for this appeal. These facts, viewed in a light most favorable to Unisys, are accepted for the purpose of establishing the factual background of this appeal.
Iowa's Medicaid program makes medical services available to eligible Iowans. The State administers the program through the Department of Human Services, who receives both state and federal funds to administer the program and reimburse medical providers for the medical services rendered to Medicaid recipients.
In 1987, the Department first entered into a contract with Unisys to help manage the program and serve as the fiscal agent. As fiscal agent, Unisys was responsible for reimbursing Medicaid providers.
Medicaid recipients are able to receive medical care under the Medicaid program through several methods. One method is to receive medical care from a medical provider on a fee-for-service basis. Another method permits recipients to receive services from health maintenance organizations (HMOs).
The Department contracted with several HMOs, including Heritage and Care Choices, to provide care to eligible recipients. *148 However, instead of paying a separate fee for each medical service rendered by the HMOs, the Department agreed to pay the HMOs a predetermined monthly fee for each Medicaid recipient enrolled in the HMO in return for providing the recipient any and all medical services needed during the month. This fee was known as the "capitation rate" and was paid whether or not a recipient actually received medical services during the month. Paragraph 6.1 of the contract between the Department and the HMOs provided:
In full consideration of contract services rendered by the HMO, the DEPARTMENT agrees to pay the HMO monthly payments based on the capitation rates specified in Addendum VI. The monthly capitation rate for each enrollee category will be as specified in the addendum, and will apply through the date of contract termination.
The "capitation rate" was determined at the beginning of each fiscal year using statistics and data of the actual medical costs of Medicaid recipients who received medical care on a fee-for-service basis during the preceding fiscal year, and was essentially the quotient of the number of months an individual was eligible for Medicaid services and the amount expended during those months on the individual. Addendum VI to the contract provided, in relevant part:
The following category-specific monthly rates are based on Iowa Medicaid's actual cost experience in each category ... for state fiscal year....
The contract then specified the rate of payment for each category of Medicaid recipient. The categories were based on the sex and age of the recipients. The contract between the Department and the HMO further provided in paragraph 6.2 that "[t]he monthly capitation rates ... shall not be subject to renegotiation during the initial contract term...." Additionally, paragraph 6.7 provided:
The DEPARTMENT will not normally recover HMO per capita payments when the HMO actually provided service, even if the recipient is subsequently determined to be ineligible for the month in question.
In instances where enrollment is disputed between two HMOs, the DEPARTMENT will be the final arbitrator of HMO membership and reserves the right to recover an inappropriate capitation payment. The DEPARTMENT also reserves the right to recover other types of inappropriate capitation payments, including but not limited to untimely notice from the HMO to the local office of the DEPARTMENT of an enrollee's request to disenroll, which had been submitted to the HMO.
Prior to 1994, the Department determined the capitation rates used to reimburse HMOs for providing medical services. However, it contracted with Unisys in the fiscal years 1994 and 1995 to assemble the necessary data to make the calculations and determine the capitation rates.
During 1994 and 1995, the Department entered into written contracts with Heritage and other HMOs to provide medical care to Medicaid recipients based on the capitation rates calculated by Unisys. The State later determined Unisys miscalculated the capitation rates used in the contracts. Consequently, the rates used in the HMO contracts were higher than they should have been if properly calculated. As a result, the State overpaid the HMOs between $15 million and $17.5 million in 1994 and 1995. Heritage and Care Choices received most of the overpayments. The State then sought to recover this amount from Unisys based upon its mistakes.
*149 Although Unisys disputed the claim brought by the State, it filed its cross-petition against Heritage and Care Choices based on the theories of unjust enrichment, indemnity, and contribution. It claimed Heritage and Care Choices were not entitled to retain the alleged overpayments because the fundamental understanding of the contract between the State and the HMOs was that the HMOs would be reimbursed at a fixed rate based upon the actual cost the State had experienced in the previous year, and a mistake in calculating those costs would entitle the State to recover overpayments from the HMOs resulting from the mistake. Unisys submitted expert evidence that the capitation rates were inflated. Heritage submitted evidence that the State did not believe Heritage was liable for the overpayments, and that it had no intention of pursuing any action against Heritage.
The district court granted summary judgment for Heritage and Care Choices. It determined unjust enrichment was not available as a theory of recovery because the claim was governed by a written contract. It also rejected the indemnification and contribution theories. In particular, the district court found Unisys had no standing as a nonparty to the contract to assert that the contract between the State and the HMOs was a product of mistake. It found the parties to the contract did not intend to permit the State to recover excessive payments to HMOs based upon the miscalculation of the capitation rates.
Unisys appealed. Following the appeal, Unisys dismissed its claims against Care Choices and dismissed its indemnity claim against Heritage. It asserts that it stated viable claims against Heritage for contribution and unjust enrichment, and is entitled to receive a trial on the merits.

II. Standard of Review.
Our review is at law. Phillips v. Covenant Clinic, 625 N.W.2d 714, 717 (Iowa 2001). We will not disturb a grant of summary judgment if there is no genuine issue of material fact and the moving party is entitled to summary judgment as a matter of law. Iowa R. Civ. P. 237(c); Fitzgerald v. Salsbury Chem., Inc., 613 N.W.2d 275, 280 (Iowa 2000). When the facts are undisputed, we reverse only if the district court misapplied the law. Fitzgerald, 613 N.W.2d at 280.
In reviewing a summary judgment ruling, we consider the facts in a light most favorable to the nonmoving party. Phillips, 625 N.W.2d at 717. In addition, we construe every legitimate inference that can be reasonably deduced from the record in favor of the party resisting the motion. Id. at 718.

III. Overview.
The right of one party, who has satisfied a claim, to seek reimbursement from another party can generally be pursued by three interrelated common law principles: indemnity, contribution, and subrogation. Chenery v. Agri-Lines Corp., 115 Idaho 281, 284, 766 P.2d 751, 754 (1988). All three principles are equitable in nature and employed to correct or prevent unjust enrichment. See 1 Dan B. Dobbs, The Law of Remedies § 4.3(4), at 604-05, 607-08 (2d ed.1993) [hereinafter Dobbs]; I George E. Palmer, The Law of Restitution § 1.5(d), at 29 (1978) [hereinafter Palmer]. In essence, these doctrines evolved from the most basic legal concept of preventing injustice. I Palmer, § 1.1, at 5. Thus, the idea of unjust enrichment is deeply engrained in our law and is widely applied. Id. at 2. It not only cuts across many areas of the law, such as contract and tort, "but it also occupies much territory that is its sole preserve." Id. It is a *150 theory to support restitution, with or without the existence of some underlying wrongful conduct. See Smith v. Harrison, 325 N.W.2d 92, 94 (Iowa 1982) ("Unjust enrichment is a doctrine of restitution."); 1 Dobbs, § 4.1(1), at 553 (plaintiff may confer benefit without any wrongdoing by defendant). Moreover, it has not only given rise to specific derivative theories, such as contribution and indemnity, but can stand on its own as an open-ended, broad theory of restitution. See I Palmer, § 1.1, at 5 ("Unjust enrichment is an indefinable idea in the same way that justice is indefinable."). We first recognized the principle of unjust enrichment early in the history of our court, see Dist. Township of Norway v. Dist. Township of Clear Lake, 11 Iowa 506, 507 (1861), and have applied it in a wide variety of cases since that time. In this case, Unisys relies on these concepts by making a specific claim for contribution, as well as a general claim for restitution based upon unjust enrichment.
One fundamental aspect of the claim for unjust enrichment involving third parties, such as contribution and other related theories, requires that the two parties to the claim be obligated to the third party. See Oregon Laborers-Employers Health & Welfare Trust Fund v. Phillip Morris Inc., 185 F.3d 957, 968 (9th Cir. 1999) (plaintiff to an unjust enrichment claim does not provide a benefit to the defendant by paying bills of third parties which the defendant had no legal obligation to pay); Chenery, 766 P.2d at 755 (claim for subrogation requires that a party making a payment to a third party must have an obligation to make that payment or a recognizable interest to protect); Shonka v. Campbell, 260 Iowa 1178, 1182, 152 N.W.2d 242, 245 (1967) (a claim for contribution requires that the injured party has a legally recognizable remedy against "both the party seeking contribution and the party from whom contribution is sought"). Therefore, in this case, the claims brought by Unisys require a showing that Heritage has a legal obligation to the State. Unisys concedes, for the purpose of its cross-petition, that it is obligated to the State.
Heritage claims it has no legal obligation to the State. Unisys asserts the State has a legal right to recover the overpayments from Heritage based on mutual mistake. Thus, we must first examine whether Unisys has established liability by Heritage based on mistake.

IV. Mutual Mistake.
Mistake in the law of contracts has different consequences depending on its relationship to the transaction and the corresponding remedy at issue. See generally II Palmer, § 11.2, at 481-95. Thus, a variety of rules and principles exist to deal with the law of mistake. These rules, however, are tailored to the circumstances that support them, and must not be broadly applied. See generally id.
Generally, mutual mistake will render a contract voidable by the party who is adversely affected by the mistake when the parties are mistaken on a basic assumption on which the contract was made, unless the adversely affected party bears the risk of mistake. Davenport Bank & Trust Co. v. State Cent. Bank, 485 N.W.2d 476, 480 (Iowa 1992); Restatement (Second) of Contracts § 152 (1981). On the other hand, a unilateral mistake by one party will not release that party from its obligation under the contract absent fraud, misrepresentation, or other misconduct. See Bachman v. Easy Parking of Am., Inc., 252 Neb. 325, 330, 562 N.W.2d 369, 373 (1997). Thus, Heritage argues that the mistake in the capitation rates was unilateral, not mutual, and there was no evidence of any misconduct to support a *151 claim against it by the State based on unilateral mistake.
We agree Unisys presented no evidence that Heritage knew the capitation rates were incorrect. However, the rules governing mutual and unilateral mistakes vary with the type of mistake involved and principally impact the rescission of a contract, not reformation. See generally II Palmer, § 11.2, at 481 95. Reformation seeks to uphold the intent of the parties to the contract and takes a different approach to mistake than when rescission is sought, especially when the mistake exists in expression. Id. § 11.2(c), at 488-89; III Id. § 13.1, at 3. On the other hand, rescission seeks to defeat the parties' intent by ending the contract altogether. III Id. § 13.1, at 3. Thus, application of the law of mistake requires courts to resolve disputes by first considering the relationship of the mistake to the transaction and its legal effect on the transaction. II Id. § 11.2, at 482.
Mistakes involving contracts "can be made in the formation, integration, or performance of a contract." Pathology Consultants v. Gratton, 343 N.W.2d 428, 437 (Iowa 1984). Mistake in expression, or integration, occurs when the parties reach an agreement but fail to accurately express it in writing. Id.; II Palmer, § 11.2, at 482. Mistakes in the formation of contracts include mistakes in an underlying assumption concerning matters relevant to the decision to enter into a contract. II Palmer, § 11.2, at 482. In this category of mistake, the agreement was reached and expressed correctly, yet based on a false assumption. Id. These two types of mistakes can be compatible, and a mistake in expression can also describe a mistake in an underlying assumption. Id. § 11.2(c), at 489.
The nature of the mistake in expression, or those instances where mistake in assumption relates to expression, is also compatible with the concept of reformation. III Id. § 13.1, at 2-4. When the understanding of the parties was not correctly expressed in the written contract, equity exists to reform the contract to properly express the intent of the parties. Akkerman v. Gersema, 260 Iowa 432, 438, 149 N.W.2d 856, 859 (1967). Furthermore, it normally makes no difference if the mistake is mutual or unilateral. See III Palmer, § 14.4, at 157-58, 161 (1978 & Supp. 1984). This is because the operative mistake is the belief of the parties that the contract correctly expresses the agreement. See II id. § 11.2(c), at 489-90 (1978). Thus, reformation is needed to give effect to the intention of the parties and to prevent unjust enrichment. Id. at 488. Without reformation, the party benefited by this mistake would receive a benefit not provided for under the agreement which the written contract was meant to express. Id.; see id. § 12.3, at 562-63; III id. § 13.7, at 44-48 (confusing mistake in expression with its cause).
In this case, Heritage contracted with the State to provide medical services for the State's Medicaid patients. In exchange, the State contracted to pay Heritage the capitation rates listed in Addendum VI. This provision provided: "The following category-specific monthly rates are based on Iowa Medicaid's actual cost experience...." We think this language shows the parties intended the contract to be based on a fee derived from the actual cost of services in the prior years, and there was no extrinsic evidence offered to show otherwise. See Iowa-Illinois Gas & Elec. Co. v. Black & Veatch, 497 N.W.2d 821, 825 (Iowa 1993) (the court is to interpret the meaning of the contract terms unless the meaning is dependent upon extrinsic *152 evidence). Thus, if the terms of the final written agreement failed to accurately express an actual cost experience capitation rate intended by the parties, the contract failed to express the intent of the parties. The contract also reveals an actual cost rate was a basic assumption on which the contract was made and the basis for the consideration paid to Heritage by the State for the services performed. It also suggests both parties believed, at the time the contract was executed, that the rates properly reflected the actual cost experience, and that neither party knew the rates were incorrectly calculated. Therefore, it makes no difference if the parties were unaware of the mistake, or if it was unilateral or mutual. Reformation is available to reform the contract to reflect the true intent of the parties. See III Palmer, § 13.1, at 3.
Notwithstanding, Heritage claims there can be no claim of mistake because the contract allocated the risk of mistake to the State. See Davenport Bank & Trust Co., 485 N.W.2d at 480 (assumption of risk of mistake will defeat a claim of mistake); Restatement (Second) of Contracts § 154 (assumption of risk). Contrary to Heritage's assertion, we can find no language in the contract revealing the parties allocated the assumption of the risk of miscalculation in the capitation rates to the State. Although the contract indicated the capitation rates could not be renegotiated and the Department would not normally recover payments, the Department reserved the right to recover inappropriate capitation payments. Clearly, recovery of mistaken payments does not constitute renegotiation of the payment rates. The contract did not allocate the risk of mistake in the capitation rates to the State. Based on the contract language, the parties intended the capitation rates to accurately reflect the actual cost experience, and neither party had reason to believe otherwise. There was no evidence offered to support a contrary conclusion.
Finally, Heritage claims Unisys is unable to use the State's claim of unjust enrichment to support its claim for contribution because the State does not intend to assert any rights against Heritage. Heritage claims the contract with the State is valid as written against the world until such time as the State elects to rescind or reform the contract. See First State Bank v. Shirley Ag Serv., Inc., 417 N.W.2d 448, 452 (Iowa 1987) (security agreement remained valid where neither party chose to avoid it due to mutual mistake).
We think this argument misses the point. The State has elected to hold Unisys accountable for the overpayments. Thus, we must focus on the rights of Unisys for contribution or other forms of unjust enrichment. A third-party claim based on unjust enrichment only requires that a legally recognizable claim exists, not the actual assertion of that claim. The inaction of the injured party does not defeat a claim for contribution. Schreier v. Sonderleiter, 420 N.W.2d 821, 825 (Iowa 1988). Unisys alleges sufficient facts to support a claim by the State against Heritage for unjust enrichment based on mistake.

V. Contribution.
The doctrine of contribution rests on the equitable principle that the parties subject to common liability should contribute equally to the discharge of that liability. Herter v. Ringland-Johnson-Crowley Co., 492 N.W.2d 672, 674 (Iowa 1992). It is founded on the principle that "when the parties stand in aequali jure, the law requires equality ... and one of them shall not be obliged to bear a common burden in ease of the rest." 18 C.J.S. Contribution § 3, at 5 (1990). A party *153 may seek contribution from another if they share a common liability, even if their liability rests on different theories. Schreier, 420 N.W.2d at 824. Thus, parties who are liable to one another because of their common liability have a right to compel contribution from each other. Stowe v. Wood, 199 N.W.2d 323, 325 (Iowa 1972).
"Common liability exists when the injured party has a legally cognizable remedy against both the party seeking contribution and the party from whom contribution is sought." McDonald v. Delhi Sav. Bank, 440 N.W.2d 839, 841 (Iowa 1989). Two or more persons must be liable to the injured party for the same damage, although liability may rest on different grounds or theories. Federated Mut. Implement & Hardware Ins. Co. v. Dunkelberger, 172 N.W.2d 137, 142 (Iowa 1969).
Unisys claims it is entitled to contribution from Heritage because Heritage and Unisys are both liable for the overpayments made by the State. For purposes of the contribution claim, Unisys claims it is liable to the State for breach of contract, and further claims that Heritage is liable to the State for restitution based on mistake. We have previously determined that Unisys has set forth facts that could support a claim for restitution between the State and Heritage based on mistake. Therefore, we turn to consider whether this form of liability is sufficient to satisfy the common liability element of a claim for contribution.
Although the State may have a remedy against either Unisys or Heritage for the overpayments it made to Heritage, this does not mean common liability exists to justify a claim for contribution. Common liability exists for the purpose of contribution when two or more actors are liable to the injured party for the same damage. Federated Mut. Implement & Hardware Ins. Co., 172 N.W.2d at 142. This common liability rule exists because the principles of equity on which the right of contribution rests are applicable only when the situation of the parties are equal. 18 C.J.S. Contribution § 6, at 8. On the other hand, "equality among [parties] whose situations are not equal is not equitable." Id.
The theories of recovery at issue in this case reveal the situations of Unisys and Heritage are not the same, and explain why contribution is not available in this case. The State's claim against Unisys is breach of contract. The State's claim against Heritage is restitution based on unjust enrichment resulting from mistake. The State has no underlying substantive claim against Heritage for wrongdoing. Instead, the claim is strictly equitable and based on unjust enrichment. Thus, the remedies available to the State under each of the theories are different. Restitution measures the remedy by the gain obtained by the defendant, and seeks disgorgement of that gain. 1 Dobbs, § 4.1(1), at 555. Damages, on the other hand, are measured by the plaintiff's loss, and seek to provide compensation for that loss. Id. This distinction means the burdens placed on the parties are different. While the State may have separate remedies against Unisys and Heritage, there is no joint liability essential to support a claim for contribution. This is borne out by assuming Heritage provided restitution to the State by returning the overpayments. In this situation, Heritage would have no contribution claim against Unisys for its share of the overpayments because Heritage did not pay for any loss but merely returned property belonging to the State. Its obligation to return the property was not based on liability shared with Unisys, but unjust enrichment. Common liability means contribution must flow in *154 either direction depending on which co-obligor or joint tortfeasor paid more than its fair share of an obligation. See Pinal Creek Group v. Newmont Mining Corp., 118 F.3d 1298, 1306 (9th Cir.1997). Parties do not share common liability if they are only severally liable on an obligation. See 18 C.J.S. Contribution § 6, at 8.
Normally, the absence of joint liability is a defense to a claim for contribution. In re Reading Co., 115 F.3d 1111, 1124 (3d Cir.1997). However, if there are no facts alleged to support joint liability, the claim must fail as a matter of law. Id. We conclude Unisys has no claim for contribution against Heritage as a matter of law.
Even when contribution fails to provide a remedy because the circumstances do not quite fit within the elements or definition of contribution, it is important to remember that the underlying reason for allowing contribution is unjust enrichment. I Palmer, § 1.5(d), at 33. Thus, if the enrichment of the defendant under the circumstances is the same whether or not the elements of contribution have been satisfied, the principles of unjust enrichment may continue to justify restitution. Id. Unjust enrichment can be the sole basis for a claim of restitution. See id. Thus, we turn to consider whether Unisys has presented a viable claim based on unjust enrichment.

VI. Unjust Enrichment.
The doctrine of unjust enrichment is based on the principle that a party should not be permitted to be unjustly enriched at the expense of another or receive property or benefits without paying just compensation. Credit Bureau Enters., Inc. v. Pelo, 608 N.W.2d 20, 25 (Iowa 2000). Although it is referred to as a quasi-contract theory, it is equitable in nature, not contractual. See Iowa Waste Sys., Inc. v. Buchanan County, 617 N.W.2d 23, 29 (Iowa Ct.App.2000). It is contractual only in the sense that it is based on an obligation that the law creates to prevent unjust enrichment. See id. at 29-30.
The doctrine of unjust enrichment serves as a basis for restitution. Smith, 325 N.W.2d at 94. It may arise from contracts, torts, or other predicate wrongs, or it may also serve as independent grounds for restitution in the absence of mistake, wrongdoing, or breach of contract.[1]See 1 Dobbs, § 4.1(1), at 553.
Recovery based on unjust enrichment can be distilled into three basic elements of recovery.[2] They are: (1) defendant *155 was enriched by the receipt of a benefit; (2) the enrichment was at the expense of the plaintiff; and (3) it is unjust to allow the defendant to retain the benefit under the circumstances.[3]See Credit Bureau Enters., Inc., 608 N.W.2d at 25; West Branch State Bank v. Gates, 477 N.W.2d 848, 851-52 (Iowa 1991). Heritage essentially argues that Unisys is unable to satisfy any of the elements of its claim for unjust enrichment for the following reasons: (1) Heritage did not receive anything that it was not entitled to receive under the contract with the State; (2) Heritage did not receive anything belonging to Unisys; and (3) Unisys should justly bear responsibility for the overpayments because they resulted from its conduct and Unisys is independently liable to the State for this conduct.
For purposes of summary judgment, Unisys has shown the mistake inured to the benefit of Heritage, who received more compensation than the parties contemplated under the contract.[4] The contract between the State and Heritage did not insulate Heritage from responsibility for any overpayments. Nevertheless, Heritage claims the overpayments cannot be considered to be a benefit for the purposes of a claim for unjust enrichment by Unisys because the funds were not conferred by or do not belong to Unisys.
We recognize unjust enrichment is a broad principle with few limitations. We have never limited this principle to require the benefits to be conferred directly by the plaintiff. See Iconco v. Jensen Constr. Co., 622 F.2d 1291, 1301-02 (8th Cir.1980) (plaintiff not required to show he directly conferred benefit on defendant under Iowa law). Instead, benefits can be direct or indirect, and can involve benefits conferred by third parties. See I Palmer, § 1.7, at 40-41, 44. The critical inquiry is that the benefit received be at the expense of the plaintiff. See Guldberg v. Greenfield, 259 Iowa 873, 878, 146 N.W.2d 298, 301 (1966).
Heritage argues the overpayments it received were not at the expense of Unisys because Unisys is independently liable to the State under the breach of its own contract. Heritage asserts this independent liability precludes any claim for unjust enrichment. We agree Unisys may be liable to the State for the overpayments independent of any responsibility of Heritage. We also agree a plaintiff who has an independent obligation to a third person cannot maintain an action for unjust enrichment against a defendant who is incidentally benefited by the performance of that obligation to the third person. See Oregon Laborers-Employers Health & Welfare Trust Fund, 185 F.3d at 968-69; Restatement (First) of Restitution § 1 (1936). By analogy, we also recognize that subrogation is not available to a person who is personally liable for the debt that *156 the person discharges. Brown v. Sheldon State Bank, 139 Iowa 83, 95, 117 N.W. 289, 293 (1908). However, Unisys is not seeking restitution from Heritage for an incidental benefit. Even though Unisys may be primarily liable to the State for its breach of contract, Heritage is potentially primarily liable to the State for restitution based on mistake. Thus, once Unisys satisfies its obligation to the State for its breach of contract, it could, at the same time, satisfy a separate restitution claim for which Heritage would be primarily responsible. Unisys will not only satisfy its own obligation if it pays the State for the overpayments, but will also satisfy a separate obligation Heritage owes to the State for which Unisys is not primarily responsible. The separate obligations of both Unisys and Heritage are critical in determining whether Heritage received a benefit at the expense of Unisys. They are also critical to understanding that the true nature of the claim by Unisys is against Heritage.
The unjust enrichment claim asserted by Unisys is actually one for equitable subrogation.[5] Subrogation, like contribution and indemnity, is a separate form of restitution. See 1 Dobbs, § 4.3(4), at 604, 608. Like unjust enrichment, the object of subrogation is to prevent injustice and rests on the principles of natural equity. Black v. Chicago Great W. R.R., 187 Iowa 904, 914, 174 N.W. 774, 778 (1919). It essentially provides that "one who has been compelled to pay a debt that ought to have been paid by another is entitled to exercise all remedies which the creditor possessed against the other." Am. Sur. Co. of New York v. Bethlehem Nat'l Bank of Bethlehem, Pennsylvania, 314 U.S. 314, 317, 62 S.Ct. 226, 228, 86 L.Ed. 241, 244 (1941) (citations omitted). This doctrine permits a person who is satisfying an obligation owed by another to a third person to be placed in the obligee's position against the primary obligor. Heritage Bank v. Lovett, 613 N.W.2d 652, 654 (Iowa 2000). Subrogation is granted to the person who is secondarily liable and "is designed to allow that party to enforce the creditor's right of exoneration against one [who] has been unjustly enriched." Id. The doctrine is needed because a person who is secondarily liable would otherwise have no cause of action against the unjustly enriched party. Id. Thus, the rationale for subrogation is "bottomed on a sensitivity to the comparative equities involved." Fed. Land Bank of Baltimore v. Joynes, 179 Va. 394, 402, 18 S.E.2d 917, 920 (1942). Where one person is more fundamentally liable for a debt which another person is obligated to pay, such a person shall not be enriched by escaping the obligation. Id.
The only twist to the doctrine of subrogation in this case is that Unisys will discharge the obligation by Heritage to make restitution when it also discharges its own obligation to the State. However, this dual discharge is not contrary to the notion that subrogation is only available to those who are secondarily liable. See Heritage Bank, 613 N.W.2d at 654. Instead, we think this equitable requirement is designed to prevent a person who is ultimately responsible for an obligation to a creditor from being subrogated to the creditor's rights against one who is only secondarily liable after the person satisfies *157 his or her own obligation. Subrogation only requires that the payment by the party seeking subrogation satisfy an obligation for which that party is not primarily liable. See id. If Unisys pays the State for the overpayments made to Heritage, it will satisfy the obligation of Heritage to make restitution for which it is not primarily liable. Moreover, as between Unisys and Heritage, Heritage is more fundamentally liable for the overpayments because the contract which contained the error is subject to reformation, which serves to correct the error.
We conclude a claim for restitution based on unjust enrichment exists against Heritage if Unisys establishes that the State has a claim for unjust enrichment against Heritage and Unisys pays the State for the overpayments based on the State's claim against Unisys for breach of contract. Yet, we recognize that the obligation or debt must be paid by the party seeking subrogation before subrogation can be enforced. Leach v. Commercial Sav. Bank of Des Moines, 205 Iowa 1154, 1161, 213 N.W. 517, 520 (1927). Thus, Unisys has no enforceable claim for restitution against Heritage until it has paid the State the full amount of its claim.[6] Notwithstanding, as with claims for contribution, this rule should not prohibit a party from filing a cross-petition for unjust enrichment in the original action by the injured party. See Tel. Herald, Inc. v. McDowell, 397 N.W.2d 518, 519 (Iowa 1986); 18 C.J.S. Contribution § 7, at 9. The trial court can impose restrictions on the enforcement of any rights against Heritage until the State is paid.

VII. Conclusion.
We conclude Unisys has established a claim for restitution based on unjust enrichment sufficient to withstand summary adjudication. The district court erred by granting summary judgment.
REVERSED AND REMANDED.
NOTES
[1]  Unjust enrichment developed from a common-law count called "money had and received," which was derived from an earlier form of action known as general assumpsit. Iconco v. Jensen Constr. Co., 622 F.2d 1291, 1295 (8th Cir.1980). This action developed gradually in the English common law, and by 1750 became a common remedy where a defendant had received money he was obligated by "natural justice and equity to refund." Id. (quoting Moses v. MacFerlan, 2 Burr. 1005, 1012, 97 Eng. Rep. 676, 681 (K.B.1760); Ames, The History of Assumpsit, 2 Harv. L.Rev. 53 (1888)). The action was quickly recognized in this country and, by the 1930's, the principle of unjust enrichment became well engrained into the law. See Iconco, 622 F.2d at 1295; Restatement (First) of Restitution § 1 (1936) ("A person who has been unjustly enriched at the expense of another is required to make restitution to the other.").
[2]  The court of appeals recently identified four elements of recovery on the basis of unjust enrichment, including the element that there be no at-law remedy available to the plaintiff. See Iowa Waste Sys., Inc., 617 N.W.2d at 30. The adequacy of a legal remedy is a general limitation on the exercise of equity jurisdiction and is properly considered when restitution is sought in equity, but no independent principle exists that restricts restitution to cases where alternative remedies are inadequate. See I Palmer, § 1.6, at 33-34.
[3]  In In re Stratman's Estate, 231 Iowa 480, 488, 1 N.W.2d 636, 642 (1942), we said: "[I]t is essential merely to prove that a defendant has received money which in equity and good conscience belongs to plaintiff." We think the three elements we have identified today capture this statement, as well as the general statements and definitions of unjust enrichment we have utilized since Stratman.
[4]  Unisys also argues Heritage not only received a benefit through the receipt of overpayments from the State, but would also receive a benefit directly from Unisys if Unisys reimbursed the State for the overpayments. However, any satisfaction by Unisys of its obligation to the State cannot actually be considered to be of benefit to Heritage when the State elected not to seek restitution from Heritage. Instead, reimbursement by Unisys helps explain why the retention of the overpayments by Heritage would be unjust.
[5]  Although subrogation was first applied to sureties, it is broad enough to cover all cases in which one person pays or satisfies an obligation which in justice and good conscience should have been paid by another. It is administered to secure real and essential justice without regard to form, and is independent of any contractual relations. See Am. Sur. Co. of New York v. State Trust & Sav. Bank of Mt. Pleasant, 218 Iowa 1, 5, 254 N.W. 338, 340 (1934).
[6]  Heritage would also have defenses to the claim for unjust enrichment by Unisys. See 1 Dobbs, § 4.6, at 656-59 (change of position); Baker v. Am. Sur. Co. of New York, 181 Iowa 634, 639, 159 N.W. 1044, 1046 (1916) (equitable subrogation doctrine is not enforced when it would be inequitable).
