IN THE COURT OF APPEALS OF THE STATE OF ILLINOIS FIRST DISTRICT FIRST DIVISION
June 28, 2004
 GENERAL AGENTS INSURANCE COMPANY OF AMERICA, INC., PLAINTIFF-APPELLEE,
MIDWEST SPORTING GOODS COMPANY, THE CITY OF CHICAGO AND THE COUNTY OF COOK, DEFENDANTS-APPELLANTS.
 Appeal from the Circuit Court of Cook County. Honorable Julia M. Nowicki, Judge Presiding.
 The opinion of the court was delivered by: Justice McNULTY
 In this case we must decide whether an insurer may recover amounts it paid for defense of its insured in a lawsuit against the insured for claims that do not fall within the coverage of the insurance policy. We hold that under the circumstances of this case, where the insured knew when it accepted the payments that the insurer intended to seek recovery of defense costs if the court agreed that the claims were not covered, the insurer may recover any payments made for the claims not covered by the policy.
 The City of Chicago (the City) and Cook County sued Midwest Sporting Goods for creating a public nuisance by selling guns to inappropriate purchasers. Midwest tendered defense of the lawsuit to its liability insurer, General Agents Insurance Company of America (Gainsco). Gainsco denied coverage, but in the letter it sent to Midwest's attorneys it wrote:
 "[W]ithout waiving any of its rights and defenses, including the right to recoup any defense costs paid in the event that it is determined that the Company does not owe the Insured a defense in this matter, the Company agrees to provide the Insured a defense in the captioned suit. In light of the competing interests between the Company and the Insured in respect of the coverage for this matter, the Company agrees to the Insured's selection and use of your firm as its counsel in this matter."
 Gainsco also sued for a judgment declaring that it had no duty to defend or indemnify Midwest.
 The trial court granted summary judgment in favor of Gainsco and this court affirmed that judgment on appeal. Gainsco then sought to recoup amounts it had paid for Midwest's defense costs. Between July 2000 and February 2001 Gainsco had paid Midwest's attorneys more than $40,000.
 The trial court again awarded judgment in favor of Gainsco, ordering Midwest to reimburse Gainsco for all payments Gainsco made to Midwest's attorneys in connection with the lawsuit. Midwest now appeals.
 Since the trial court granted judgment on uncontested evidence without holding an evidentiary hearing, we review the judgment de novo. See People v. Coleman, 183 Ill. 2d 366, 387-89 (1998).
 Midwest argues that Gainsco paid defense costs pursuant to the insurance contract, and the contract makes no provision for the recovery Gainsco seeks. According to Midwest, Gainsco cannot recover on a theory of unjust enrichment because a contract governs their relationship. We find that Midwest misconstrues the payments Gainsco made.
 When Midwest tendered defense of the lawsuit to Gainsco, Gainsco promptly denied coverage and sued for a judgment declaring that it had no duty to defend. But during the pendency of the declaratory judgment action, while the court undertook the process needed to determine whether Gainsco owed Midwest any defense, Gainsco offered to pay part of Midwest's costs of defending the City's lawsuit -- with the qualification that Gainsco would seek reimbursement if the court determined that it owed no duty to defend.
 We find the arrangement similar to the arrangement made between the parties in City of Chicago v. McKechney, 205 Ill. 372 (1903). In that case the City in 1895 agreed to pay McKechney to construct a tunnel. In 1897 McKechney demanded increased payments because he encountered unexpected difficulties in the course of construction. When the City made a partial payment at the original rate rather than the increased rate, McKechney stopped work and sued the City. He claimed that the inadequate payments violated an 1897 revision of the original contract.
 The City denied liability but sought to have the work resumed. In 1898 the City and McKechney made a new arrangement for resumption of the work pending determination of the parties' rights in the lawsuit. Under the 1898 agreement the City promised to pay McKechney at a rate higher than the agreed rate stated in the 1895 contract, but
 "'without prejudice *** so that the final judgment or decree may be in accordance with the rights of the parties upon the merits, as determined by the court, independent of such arrangement for the resumption of the work. In the final adjustment the city to receive credit for all moneys paid to said contractors on any account in connection with the construction ***, and in the event that an over-payment shall be found to have been made, the city to be entitled to recover the amount of such over-payment.'" McKechney, 205 Ill. at 436-37.
 McKechney claimed that the City made its subsequent payments under the 1897 revision, thereby acknowledging that revision as a binding contract. Our supreme court rejected that argument. Instead the court found that the 1898 accommodation pending litigation effectively preserved the City's rights under the 1895 contract, including the right to pay no more than the amount due thereunder. The court held that the 1897 document did not effectively revise the 1895 contract. The City recovered amounts paid under the 1898 accommodation in excess of amounts owed under the 1895 contract.
 Here, Gainsco offered a similar accommodation pending litigation to determine whether Gainsco owed Midwest the cost of defending the lawsuit the City of Chicago brought against Midwest. Like the 1898 arrangement in McKechney, the accommodation proposed in Gainsco's letter reserved rights to litigate the question of whether Gainsco owed the payments sought, and the right to recover any amounts the court later determined Gainsco did not owe. We find no reason to invalidate the accommodation pending litigation here.
 The court in Buss v. Superior Court, 16 Cal. 4th 35, 939 P.2d 766, 65 Cal. Rptr. 2d 366 (1997), reached a similar result. H&H Sports asserted 27 causes of action against Buss in a single lawsuit, and Buss tendered defense to his insurer, Transamerica. Transamerica found potential coverage for one of the causes of action, so it accepted the tender of defense. But in its letter accepting the tender, Transamerica asserted that it was reserving the right to deny coverage and to recover costs paid for defense of claims not within the coverage of Transamerica's policy. Buss acknowledged the reservation of rights and formalized the arrangement in a written agreement. Following settlement of H&H's lawsuit against Buss, Transamerica sought reimbursement of most of the fees paid for defense. The trial court found that most of the fees paid for work on claims not within the coverage of Transamerica's policy, and the court ordered Buss to reimburse those fees.
 The Supreme Court of California held:
 "Under the policy, the insurer does not have a duty to defend the insured as to the claims that are not even potentially covered. With regard to defense costs for these claims, the insurer has not been paid premiums by the insured. It did not bargain to bear these costs. To attempt to shift them would not upset the arrangement. [Citation.] The insurer therefore has a right of reimbursement." Buss, 16 Cal. 4th at 51, 939 P.2d at 776, 65 Cal. Rptr. 2d at 376.
 See also Krusinski Construction Co. V. Northbrook Property & Casualty Insurance Co., 326 Ill. App. 3d 210, 224 (2001).
 In Walbrook Insurance Co. v. Goshgarian & Goshgarian, 726 F. Supp. 777, 784 (C.D. Cal. 1989), the insurer denied coverage for the lawsuit against its insured and sued for a judgment declaring that it had no contractual obligation to provide a defense. The insurer offered to pay the costs of defense in the underlying lawsuit pending determination of the declaratory judgment action, but it reserved the right to seek reimbursement of the defense costs if the court decided it had no duty to defend the insured. The insured accepted the tendered payments while protesting that the insurer had no right to reimbursement. The court held:
 "[D]efendants knew that plaintiffs intended to seek reimbursement if it was found that there was no duty to defend. *** While defendants did specifically object to this reservation, they also accepted $500,000 in defense costs from plaintiffs. This would be inconsistent with their objections, as they are refusing to accept the agreement yet retaining the fruits of it. There is adequate evidence showing an 'understanding' that plaintiffs would seek reimbursement. Furthermore, this Court holds that acceptance of the monies constitutes an implied agreement to the reservation." Walbrook, 726 F. Supp. at 784.
 The United States District Court for the Southern District of Illinois believed that Illinois courts would follow the reasoning Buss and Walbrook. In Grinnell Mutual Reinsurance Co. v. Shierk, 996 F. Supp. 836 (S.D. Ill. 1998), the insurer agreed to pay defense costs, but it reserved the right to deny coverage, and it asserted the right to seek reimbursement of defense costs if a court found it had no duty to defend. The insurer sued for a judgment declaring that it had no duty to defend its insured. The court awarded the insurer the judgment. The insurer then sought reimbursement of its payments for the defense. Following the reasoning of Buss, the court held that the insurer had a right to reimbursement of defense costs it paid, because the insurance policy did not cover any of the claims against the insured. And following Walbrook, the court found the reservation of the right to reimbursement sufficient, without express consent from the insured. Grinnell, 996 F. Supp. At 839.
 Midwest argues that we should not adopt the reasoning of Grinnell, Buss and Walbrook, because those cases give the insurer too much leverage. If an insurer wrongly refuses to defend its insured it loses all policy defenses. See La Rotunda v. Royal Globe Insurance Co., 87 Ill. App. 3d 446, 452 (1980). If the insurer pays for defense costs under a reservation of rights, it retains policy defenses, but it usually does not recover amounts paid for the defense. According to Midwest, the court in Grinnell allowed the insurer "to challenge its duty to defend risk free, with no loss of policy defenses and with the potential to recoup unlimited defense costs." Midwest claims this makes the Grinnell decision "disastrous for insureds." Midwest explains:
 "[I]f insurance companies can agree to defend with a reservation of rights and a chance to recoup defense costs, then insureds are in a situation where they do not know if they will have to pay for defense costs. Insureds would be in a worse position than if they had no insurance, in that they would not be able to factor in defense costs into their overall decision to contest a lawsuit or settle since they would not know who was paying for defense until after substantial fees were incurred."
 The court in Walbrook noted that its decision left insureds the possibility of forcing insurers to elect whether to defend or refuse to defend:
 "Perhaps if defendants had specifically asked plaintiffs to make such an election prior to accepting any of the defense funds an election would be forced." Walbrook, 726 F. Supp. at 784 n.3.
 We agree. If Midwest refused to accept the funds on the conditions Gainsco imposed, it could force Gainsco to choose either to defend without a right of reimbursement, or to deny a defense and risk losing all policy defenses if a court found it in breach of the insurance contract.
 Gainsco's offer did not place Midwest in a worse position than it would have had without the offer. Midwest chose its counsel, and Gainsco's offer did not affect the choice. Without the offer Midwest would still have been uncertain who would ultimately pay defense costs, because Midwest sought to recover such expenses in its counterclaim against Gainsco. Pending determination of the counterclaim Midwest would face the same uncertainty it faced here -- it just would not have had use of Gainsco's money while the parties litigated the claim.
 Contrary to Midwest's central assertion, we find that Gainsco did not make the payments to Midwest's counsel pursuant to the insurance contract. Instead, Gainsco made these payments as an accommodation pending litigation to determine whether Gainsco owed Midwest, under the insurance contract, a defense to the City of Chicago's lawsuit. Midwest accepted the conditions Gainsco placed on the accommodation by accepting the checks it received. Just as our supreme court enforced the terms of the accommodation the parties made in McKechney, we find the accommodation here enforceable. The trial court properly enforced the accommodation by ordering Midwest to reimburse Gainsco the amount Gainsco paid for defense against claims not covered by Gainsco's policy. Accordingly, we affirm the judgment of the trial court.
 O'MALLEY, P.J. concurs.
 McBRIDE, J., dissents.
 I respectfully dissent from the majority's decision to allow reimbursement of defense costs in this case of first impression. Although there is authority from other jurisdictions which has permitted reimbursement of costs based upon a reservation of rights letter similar to the one here (for example Buss cited by the majority), I do not believe Illinois case law supports the majority's decision. Under Illinois law, an insurer's duty to defend its insured arises from, and is limited by, the express undertaking to defend as stated in the contract of insurance. Conway v. County Casualty, 92 Ill. 2d 388, 394, 442 N.E.2d 245 (1982). The policy here contained the following language:
 "We have the right and duty to defend, at our expense, any claim, proceeding or suit against you for damages payable by this insurance ***. We have no duty to defend a claim, proceeding or suit that is not covered by this insurance." (Emphasis added.)
 This language states that a defense undertaken by Gainsco would be at its own "expense." There is no contract language providing for reimbursement of costs in the event a court later finds that there is no duty to defend. Because that language could easily have been included in the policy and bargained for by the parties, I would not allow for reimbursement.
 Further, the Illinois supreme court has repeatedly held that when a complaint against an insured alleges facts within or potentially within the scope of coverage, an insurer taking the position that the complaint is not covered has two options: defend under a reservation of rights or seek a declaratory judgment that there is no coverage. State Farm Fire and Casualty v. Martin, 186 Ill. 2d 367, 373, 710 N.E.2d 1228 (1999). These are two separate and distinct options. State Farm, 186 Ill. 2d at 373. Only if an insurer fails to take either of these steps and is later found to have wrongfully denied coverage, "is the insurer estopped from raising policy defenses to coverage." Employers Insurance v. Ehlco Liquidating Trust, 186 Ill. 2d 127, 150-51, 708 N.E.2d 1122 (1999). Gainsco, like other insurers, chose both, it defended under a reservation of rights and sought a declaratory judgment. See Insurers Co. of Illinois v. Markogianakis, 188 Ill. App. 3d 643, 652, 544 N.E.2d 1082 (1998). Additionally though, in a letter reserving its policy rights, Gainsco said it would reserve its rights to recoup its defense costs. As pointed out above however, the policy does not contain any such right. Because Illinois law provides the insurer with the option of filing a declaratory judgment, without forwarding defense costs, Gainsco should not be allowed to create a third option the insured never agreed to or anticipated.
 In its five page reservation of rights letter, dated July 23, 1999, Gainsco begins by pointing out that it has reviewed the "First Amended Complaint" naming its insured Midwest. After that, it details certain provisions, definitions, and exclusions contained in the subject policy. It indicates, among other things, that since the policy applies to damages because of property damage or bodily injury caused by an occurrence, the "claim" is not covered by the policy. The letter also says the "claim" may not be covered because the first Amended Complaint alleges "that the Insured is liable to plaintiffs for *** intentional and/or willful conduct." Then, after pointing out numerous reasons why the policy does not cover the claim, Gainsco states "subject to the foregoing and without waiving any of its rights and defenses, including the right to recoup any defense costs *** the Company agrees to provide a defense in the captioned suit *** the Company notes its right to associate with the Insured and its counsel in the defense of the underlying litigation." Toward the end of this letter, it adds the following:
 "Please note that any acts taken by or on behalf of the Company are taken under and pursuant to a full reservation of rights and defenses under the Policy. Likewise, we will understand that any acts taken by or on behalf of the Insured are taken pursuant to a reservation of its rights as well."
 In my opinion, this letter was a clear indication by Gainsco that it would defend its insured under a reservation of policy rights.
 Gainsco claims its insured accepted the benefits of an implied agreement that Gainsco would be reimbursed if there was no duty to defend. Midwest says there was no agreement and that Gainsco was doing only what it was obligated to do under the policy. The majority has adopted Gainsco's view and relies upon McKechney, a 1903 supreme court decision involving a dispute over a construction contract. McKechney, 205 Ill. 372 (1903). I do not think McKechney is particularly helpful in this case because it did not involve an insurer and its insured.
 Buss, a California decision the majority relies upon, which we are not bound to follow, is clearly distinguishable. In that case, after the insurance company forwarded its reservation of rights letter to its insured, the parties "entered into an agreement supported by consideration" that if a court ordered defense costs to be shared pro rata, Buss would reimburse its insurance company. Buss, 65 Cal. Rptr. 2d at 370. Since there was no agreement established here, and certainly no consideration for such an agreement, I would reverse.
 Grinnell, also relied upon by the majority, is equally unpersuasive because it does not look to Illinois law at all in interpreting the question of reimbursement. Grinnell, 996 F. Supp 836 (1998). Before today, Grinnell has never been followed by any Illinois court.
 Walbrook, 726 F. Supp 777, 784 (1989), is of questionable validity under Illinois law; it holds an implied agreement to reimbursement is created despite an insured's objection to an insurer's reservation of defense costs.
 Not one of these cases discusses an insurer's right in Illinois to file a declaratory judgment when it disputes coverage. Not one of these cases suggests that a provision like the one in this policy was present in the relevant insurance policies, specifically that the "right" to defend will be at the insurer's "expense." Because Gainsco exercised its "right" to defend, it agreed to defend, and the policy provides it will be at Gainsco's "expense," it is not entitled to reimbursement of its expenses in defending its insured.
 As pointed out by Midwest, Illinois law does not generally allow parties to a contract to go outside the contract terms in an attempt to recover money damages based upon equitable or quasi-contract principles. La Throp v. Bell Federal Saving and Loan Ass'n, 68 Ill. 2d 375, 391, 370 N.E.2d 188 (1977)("where there is a specific contract which governs the relationship of the parties, the doctrine of unjust enrichment has no application"); Industrial Lift Truck Service v. Mitsubishi International, 104 Ill. App. 3d 357, 360, 432 N.E.2d 999(1982)(as a general rule no quasi-contractual claim can arise when a contract exists between the parties concerning the same subject matter on which the quasi-contractual claim rests) .
 I would also reverse the trial court's decision because no specific theory of relief was pled in Gainsco's declaratory judgment complaint. Although Gainsco claims it was entitled to defense costs based upon a theory of unjust enrichment, it has been somewhat vague about this theory of relief both here and in the trial court. Either way, its complaint does not state any legal basis for relief; for that reason I believe the order should be reversed.
 The majority also suggests that Midwest should have turned down the defense of the suit and forced the issue. I do not agree. Only in hindsight did either party learn that there was no duty to defend. To tell an insured that it cannot accept defense payments because of some language that was slipped into a five page reservation of rights letter again seems wrong, particularly when Illinois precedent gives an insurer the right to file a declaratory judgment to dispute coverage.
 Additionally, in its reservation of rights letter, Gainsco stated that "any acts taken" are taken under "a full reservation of its rights and defenses under the policy." The question then becomes, were the defense costs initially paid by Gainsco "acts taken under a full reservation of its rights and defenses." If so, shouldn't Gainsco be held to the provision that its "right" and "duty" to defend will be at its own "expense?" It should also be noted that this motion for reimbursement of costs was decided similarly to a motion for summary judgment. Therefore, unless we can say that Gainsco was entitled to a judgment of its costs as a matter of law, the motion should have been denied. At a minimum, there are unresolved questions of material fact as to Gainsco's intent when it originally paid the defense costs. See Insurance Co. of the West v. Haralambos Beverage Co., 195 Cal. App. 3d 1308, 1323, 241 Cal. Rptr. 427 (1987)(summary judgment order reversed for trial on whether insured entered into an agreement to reimburse insurer or whether under a theory of equitable restitution the insurer conferred a benefit incidental to the protection of its own interest).*fn1 Therefore, I would reverse the decision of the trial court.
 It also seems unfair for Gainsco to call upon the policy provisions to reserve its rights and defenses, yet later disavow that same policy in terms of the payments it has made. In its letter, Gainsco specifically said it was agreeing to provide a defense in the "captioned suit," but now disavows that as well. Without being too repetitive, Gainsco could have filed a declaratory judgment without agreeing to defend at the same time. As pointed out above, it does not lose its policy defenses by exercising that option. Only when an insured does not exercise either option, can estoppel apply. Ehlco, 186 Ill. 2d at 150-51. Although I am not encouraging this second option as a matter of course, Illinois law provides for it.
 Finally, there is authority from other jurisdictions which supports denying the reimbursement of defense costs sought here. See e.g. Terra Nova Insurance Co., Ltd., v. 900 Bar, Inc., 887 F. 2d 1213, 1219-20 (1989)(concluding generally, under Pennsylvania law, that even when the insurer defends under a reservation of rights letter, it may not later recover costs expended in defending the insured, on the ground that the insurer's provision of a defense is as much for its own benefit as for the insured's).
 For all of the above reasons, I would deny reimbursement of defense costs. In the alternative, I would remand this matter for a trial to determine whether the defense costs in this case were actually paid pursuant to the policy or whether there was an agreement between the parties that Gainsco would be reimbursed by Midwest because of a subsequent court order that there was no duty to defend.