
805 N.E.2d 241 (2004)
346 Ill. App.3d 564
281 Ill.Dec. 873
Ricky NESBY, Plaintiff-Appellant,
v.
COUNTRY MUTUAL INSURANCE COMPANY, Defendant-Appellee.
No. 5-03-0225.
Appellate Court of Illinois, Fifth District.
Filed January 14, 2004.
Motion to Publish Granted February 20, 2004.
Opinion Filed February 20, 2004.
John D. Alleman, Alleman & Hicks, Carbondale, for Appellant.
Robert W. Schmieder II, Sonnenschein, Nath Joseph A. Bleyer, Bleyer and Bleyer, Marion, for Appellee.
*242 Justice KUEHN delivered the opinion of the court:
The plaintiff Ricky Nesby appeals from the circuit court's dismissal of his complaint for equitable relief against the defendant Country Mutual Insurance Company (Country Mutual). We affirm.
The plaintiff held an automobile insurance policy with Country Mutual (the policy). The policy provided medical-payments coverage for the payment of medical bills incurred as a result of injuries sustained while a passenger in the covered automobile. The terms of the policy issued by Country Mutual contained a "right to recover payment" provision that allowed Country Mutual to obtain the insured's right to recover against a third party after Country Mutual paid the plaintiff's medical bills. In addition, the provision gave Country Mutual the right of reimbursement if the insured directly recovered damages. The provision provided in pertinent part as follows:
"9. OUR RIGHT TO RECOVER PAYMENT (SUBROGATION)
a. If we make payment under this policy, other than Death Benefit, Coverage C-1, and the person to or from whom payment was made has a right to recover damages, we will be subrogated to that right (have the right transferred to us). That person must do whatever is necessary to enable us to exercise our rights and must do nothing after the loss to prejudice our rights.
b. If we make a payment under this policy, other than Death Benefit, Coverage C-1, and the person to or for whom payment was made recovers damages from another, that person must hold the proceeds of the recovery in trust for us and must reimburse us to the extent of our payment."
The plaintiff was involved in an automobile accident in 2000. In connection with the accident, Country Mutual paid $4,793 in medical expenses incurred by the plaintiff, in accordance with the medical-payments coverage under the policy. Thereafter, the plaintiff directly pursued the responsible party for his injuries. Country Mutual asserted an interest in the proceeds recovered by the plaintiff. Pursuant to the claimed interest, on December 11, 2000, the plaintiff paid the defendant $4,793 (less his attorney fees for collecting said amount under the commonfund doctrine), for a net reimbursement to the defendant of $3,195.33.
On August 21, 2002, the plaintiff filed a complaint alleging that Country Mutual was unjustly enriched by the plaintiff's reimbursement of the medical payments made by Country Mutual on his behalf. On October 9, 2002, Country Mutual filed a motion to dismiss the plaintiff's complaint. On November 14, 2002, the trial court dismissed the plaintiff's complaint without prejudice and granted the plaintiff 28 days to amend his complaint. No amended complaint was filed. On March 21, 2003, the trial court dismissed the plaintiff's complaint with prejudice. The plaintiff appeals.
On appeal, the plaintiff contends that Country Mutual had no reimbursement right to recover payments for medical expenses because the policy language is ambiguous. Based on the alleged ambiguity, the plaintiff contends that his complaint sufficiently states a cause of action for unjust enrichment.
A motion to dismiss filed pursuant to section 2-615 of the Code of Civil Procedure (735 ILCS 5/2-615 (West 2002)), which attacks only the legal sufficiency of a complaint, admits all wellpleaded facts but does not admit unsupported *243 legal or factual conclusions. Benge v. State Farm Mutual Automobile Insurance Co., 297 Ill.App.3d 1062, 1066, 232 Ill.Dec. 172, 697 N.E.2d 914, 917 (1998). The court must interpret the factual allegations in the light most favorable to the plaintiff. Benge, 297 Ill.App.3d at 1066, 232 Ill.Dec. 172, 697 N.E.2d at 917. A complaint should be dismissed pursuant to section 2-615 only if no set of facts could be proven that would entitle the plaintiff to the relief he seeks. People ex rel. Peters v. Murphy-Knight, 248 Ill.App.3d 382, 386, 187 Ill.Dec. 868, 618 N.E.2d 459, 463 (1993). We review the trial court's ruling on a motion to dismiss de novo, and we can affirm on any basis present in the record. Toombs v. City of Champaign, 245 Ill. App.3d 580, 583, 185 Ill.Dec. 755, 615 N.E.2d 50, 51 (1993).
The theory of unjust enrichment is an equitable remedy based upon a contract implied in law. People ex rel. Hartigan v. E & E Hauling, Inc., 153 Ill.2d 473, 497, 180 Ill.Dec. 271, 607 N.E.2d 165, 177 (1992). The basis for the unjust-enrichment doctrine is that no one ought to enrich himself unjustly at the expense of another. Village of Bloomingdale v. CDG Enterprises, Inc., 196 Ill.2d 484, 500, 256 Ill.Dec. 848, 752 N.E.2d 1090, 1102 (2001).
Because it is an equitable remedy, unjust enrichment is only available when there is no adequate remedy at law. Season Comfort Corp. v. Ben A. Borenstein Co., 281 Ill.App.3d 648, 656, 211 Ill. Dec. 682, 655 N.E.2d 1065, 1071 (1995). Where there is a specific contract that governs the relationship of the parties, the doctrine of unjust enrichment has no application. Hartigan, 153 Ill.2d at 497, 180 Ill.Dec. 271, 607 N.E.2d at 177.
In the instant case, an automobile insurance policy governed the relationship of the parties. The language in the plaintiff's policy clearly states that if the plaintiff recovers from another, Country Mutual obtains the right to be reimbursed to the extent of its payment. It is the unambiguous contract language that controls, not equitable considerations. Because the plaintiff had a contractual obligation to reimburse Country Mutual for the medical payments made on his behalf, the plaintiff cannot allege any facts upon which relief may be granted. The trial court properly dismissed the complaint.
For the foregoing reasons, we affirm the judgment of the circuit court of Williamson County.
Affirmed.
HOPKINS and DONOVAN, JJ., concur.
