
937 N.E.2d 323 (2010)
AMERICAN FAMILY MUTUAL INSURANCE COMPANY, as subrogee of Michael P. McGrath, Jr., Plaintiff-Appellant,
v.
NORTHERN HERITAGE BUILDERS, L.L.C., and Patrick Plunkett Architectural Design, Ltd., Defendants-Appellees. and
Rapciak Construction, Inc., Defendant.
No. 1-10-0216.
Appellate Court of Illinois, First District, First Division.
October 12, 2010.
*324 Sneckenberg, Thompson & Brody, LLP, Chicago (William Sneckenberg, Steven Thompson, Emilie Kaplan, of counsel), for Appellant.
Senak Smith & Michaud, Ltd., Chicago (Thomas A. Smith, Kelly A. Fox, of counsel), Scott & Krauss, LLC, Chicago (Gregory Bird, Sonia Kinra, Blair Lazarus, of counsel), for Appellees.
Justice HOFFMAN delivered the opinion of the court:
American Family Insurance Company (American Family) appeals from an order of the Circuit Court of Cook County which dismissed its action against Northern Heritage Builders, L.L.C. (Northern Heritage), and Patrick Plunkett Architectural Design, Ltd. (Patrick Plunkett). American Family brought the instant action against Northern Heritage and Patrick Plunkett as the subrogee of its insured, Michael P. McGrath, Jr. (McGrath), asserting claims based upon a theory of equitable subrogation by reason of its having made payments *325 to McGrath under a policy of insurance for water damage to his residence. The trial court found that, since its policy of insurance with McGrath provides for subrogation, American Family had not, and could not, assert claims based upon the doctrine of equitable subrogation. For the reasons which follow, we agree and affirm the judgment of the circuit court.
The facts of this case are not in dispute. McGrath is the owner of a three-story single-family residence located at 1848 N. Orchard, Chicago, Illinois. The residence was designed by Patrick Plunkett and built by Northern Heritage pursuant to contracts entered into with McGrath.
McGrath purchased a homeowner's policy from American Family insuring the residence (the Policy). On August 23, 2006, while the Policy was in force, McGrath made a claim under the Policy for damage to the residence by reason of rain and moisture penetrating the exterior due to alleged faulty construction. American Family denied the claim, and McGrath filed suit against American Family in the United States District Court for the Northern District of Illinois (hereinafter referred to as the Federal Action).
On August 6, 2007, while the Federal Action was pending and undetermined, McGrath filed suit in the Circuit Court of Cook County against Northern Heritage and Rapciak Construction, Inc. (hereinafter referred to as case 07 L 8252), seeking damages for the construction defects which resulted in the same damage to his residence that gave rise to the claim that was the subject of the Federal Action against American Family. Following the filing of case 07 L 8252, an order was entered in the Federal Action granting a summary judgment in favor of McGrath on the issue of coverage under the Policy for the water damage to his residence. Thereafter, the Federal Action was tried, resulting in a jury verdict in favor of McGrath. Subsequent to the verdict, on May 16, 2008, McGrath and American Family settled the Federal Action, and American Family paid McGrath under the Policy for the damage to his residence. The terms of the settlement are contained in a written agreement which does not contain an assignment to American Family of McGrath's rights of recovery against any party by reason of the damage to his residence.
On May 20, 2008, American Family filed the instant action as the subrogee of McGrath, which was docketed in the Circuit Court of Cook County as case 08 L 5548. American Family asserted the same allegations as McGrath made in case 07 L 8252. On July 22, 2008, an order was entered consolidating McGrath's action, case 07 L 8252, and the American Family action, case 08 L 5548, for purposes of discovery.
On March 13, 2009, American Family filed its third amended complaint in the instant action, case 08 L 5548, asserting claims based upon a theory of equitable subrogation against Northern Heritage and Patrick Plunkett by reason of the payment it made to McGrath for construction defects which resulted in damage to his residence. In addition to a recitation of the foregoing historical facts, American Family attached to, and incorporated into, its third amended complaint a certified copy of the Policy which, as it relates to subrogation, provides as follows:
"Subrogation. An insured may waive in writing before a loss all rights of recovery against any person. If not waived, we may require an assignment of rights of recovery for a loss to the extent that payment is made by us.
If an assignment is sought, an insured must sign and deliver all related papers and cooperate with us.

*326 Where prohibited by law, subrogation does not apply under Section II to Medical Expense Coverage or Damage to Property of Others."
On May 13, 2009, Patrick Plunkett filed a combined motion pursuant to section 2-619.1 of the Code of Civil Procedure (Code) (735 ILCS 5/2-619.1 (West 2008)), seeking dismissal of American Family's third amended complaint. Northern Heritage joined in the motion on the following day. Pursuant to section 2-615 (735 ILCS 5/2-615 (West 2008)), the motion argued that the third amended complaint was insufficient at law for the following reasons: 1) American Family failed to plead how and when it became the subrogee of McGrath's rights of action in violation of section 2-403 of the Code (735 ILCS 5/2-403 (West 2008)); 2) the third amended complaint was not verified; and 3) it fails to state a claim based upon a theory of equitable subrogation by reason of the existence of a contractual subrogation provision in the Policy. In support of its prayer for involuntary dismissal pursuant to section 2-619 (735 ILCS 5/2-619 (West 2008)), the motion asserted that, as McGrath had never assigned his rights to recover pursuant to the terms of the Policy, American Family could not maintain a claim as his subrogee. The argument was supported by McGrath's answer to a request to admit facts wherein he denied ever having assigned his rights to American Family.
On July 13, 2009, American Family moved for leave to file an amendment to its third amended complaint, supplying the verification which had been omitted when the third amended complaint was originally filed.
On August 3, 2009, the circuit court entered an order granting the motion to dismiss the third amended complaint and entering judgment thereon in favor of Patrick Plunkett and Northern Heritage. In addition, the circuit court made the requisite finding under Supreme Court Rule 304(a) (210 Ill.2d R. 304(a)) that there was no just reason to delay enforcement or appeal from its order.
On August 27, 2009, American Family filed a motion seeking reconsideration of the dismissal order of August 3rd. That motion was denied on December 22, 2009, and this timely appeal followed. A motion to dismiss pursuant to section 2-615 of the Code tests the legal sufficiency of a complaint; whereas, a section 2-619 motion admits the legal sufficiency of the complaint, but asserts affirmative matter outside of the complaint which defeats the claim. Solaia Technology, LLC. v. Specialty Publishing Co., 221 Ill.2d 558, 578-79, 304 Ill.Dec. 369, 852 N.E.2d 825 (2006). Our review of a dismissal under either section of the Code is de novo. King v. First Capital Financial Services Corp., 215 Ill.2d 1, 12, 293 Ill.Dec. 657, 828 N.E.2d 1155 (2005).
In urging reversal, American Family argues that, once it paid McGrath's claim under the Policy, it was equitably subrogated to his rights of action against the wrongdoers responsible for the loss to the extent of its payment to McGrath. It asserts that this equitable subrogation is independent of any rights under the Policy. Patrick Plunkett and Northern Heritage argue that, because the Policy provides for contractual subrogation, American Family is not entitled to any recovery under an equitable subrogation theory.
The right of subrogation originated as a creature of chancery as a doctrine which allowed a person compelled to pay the debt or claim of another to succeed to that person's rights with respect to the debt or claim so paid. This common law or equitable right of subrogation is a remedial *327 device utilized to prevent unjust enrichment. Dix Mutual Insurance Co. v. LaFramboise, 149 Ill.2d 314, 319, 173 Ill. Dec. 648, 597 N.E.2d 622 (1992). Now, a right of subrogation may also arise by statute or contract. In re Estate of Scott, 208 Ill.App.3d 846, 848, 153 Ill.Dec. 647, 567 N.E.2d 605 (1991). In this case, we address the question left unanswered by the supreme court in Schultz v. Gotlund, 138 Ill.2d 171, 173, 149 Ill.Dec. 282, 561 N.E.2d 652 (1990); namely, the effect of an express contractual subrogation provision on a common law or equitable subrogation theory of recovery. Schultz, 138 Ill.2d at 173, 149 Ill.Dec. 282, 561 N.E.2d 652.
Where the right of subrogation is created by the terms of an enforceable contract, the contract terms control, rather than common law or equitable principles. Benge v. State Farm Mutual Automobile Insurance Co., 297 Ill.App.3d 1062, 1071, 232 Ill.Dec. 172, 697 N.E.2d 914 (1998). As stated in Couch on Insurance, "where the right of an insurer to subrogation is expressly provided for in the policy, its right must be measured by, and depend solely on, the terms of such provisions." 16 Couch on Insurance Law § 222:23, at 222-51 (3rd ed.2000). Stated otherwise, common law or equitable subrogation cannot stand in the face of an express contractual right of subrogation. See Benge, 297 Ill.App.3d at 1071, 232 Ill.Dec. 172, 697 N.E.2d 914; Capitol Indemnity Corp. v. Strike Zone, S.S.B. & B. Corp., 269 Ill. App.3d 594, 596, 206 Ill.Dec. 943, 646 N.E.2d 310 (1995); In re Estate of Scott, 208 Ill.App.3d at 848, 153 Ill.Dec. 647, 567 N.E.2d 605. We conclude, therefore, that whatever right of subrogation American Family acquired in this case by reason of its having paid McGrath for the damage to his residence, it acquired pursuant to the subrogation provision of the Policy, not by virtue of any equitable or common law principle.
The terms of an unambiguous insurance policy should be enforced as written. King v. Allstate Insurance Co., 269 Ill.App.3d 190, 192, 206 Ill.Dec. 498, 645 N.E.2d 503 (1994). According to the unambiguous language of the Policy, American Family had the right to require McGrath to execute an assignment of his rights of recovery for the damage to his residence to the extent that American Family paid the loss. In support of the section 2-619 grounds for involuntary dismissal of American Family's third amended complaint, Patrick Plunkett attached a copy of McGrath's answer to a request to admit facts wherein he denied ever having assigned his rights of recovery to American Family. No counter-evidentiary material was filed by American Family. In the absence of such an assignment, American Family failed to perfect its rights of subrogation under the terms of the Policy, and for this reason, we affirm the dismissal of its third amended complaint.
Affirmed.
HALL, P.J., and LAMPKIN, J., concur.
