P entered into a long-term service agreement with Apple Orthodontix, Inc. ('Apple'). Apple provided 'practice management services' to orthodontic practices in seventeen states before filing for bankruptcy in 2000. Apple sold some of its assets, including the Packard-Apple contract, to D. Shortly thereafter, P and D entered into several agreements. D paid to D almost five million dollars in exchange for, among other things and relevant here, the entry into a long-term management services agreement that superseded the P-Apple contract. This new agreement, the Business Services Agreement (BSA), included a twenty-five-year term for which D would provide P with business and administrative support and services. The BSA also called for D to develop up to seven new offices with P, with D advancing the money needed to develop the new offices. Five years into the BSA, P terminated the BSA and sued for a declaratory judgment that the agreements were illegal, and therefore void. D counterclaimed for breach of contract, conversion, unjust enrichment, promissory estoppel, money had and received, account stated, declaratory judgments that the contracts were legal, breach of warranty and indemnity, and attorney's fees. D introduced evidence that it had paid P approximately $4,992,674.00 in up-front affiliation payments and advances and argued that-taking into account the sums Packard paid D during the five years of the BSA-Packard retained a net benefit of approximately $2,279,275.00. P moved for summary judgment as to the illegality of the contract. In December 2008, this court declared D's standard contracts illegal under Texas law, concluding that the agreements allowed D to engage in the unlicensed practice of dentistry. D conceded the illegality of the agreements, leaving its equitable counterclaims as the only remaining issues for resolution. P moved for summary judgment as to the counterclaims. The court granted the motion and D appealed.