This appeal presents the question of whether the doctrine of sovereign immunity bars a quantum meruit action against the State of North Carolina.
In the complaints filed in these actions, plaintiff makes the following allegations. Since 1967, Paul Whitfield, plaintiffs principal attorney, has represented defendants in filing various public nuisance actions. Defendant Gilchrist, as District Attorney for the 26th Judicial District, engaged him for the purpose of filing a public nuisance action against the Downtown Motel Corporation, a North Carolina corporation, known as the Downtown Motor Inn on North Tryon Street in the City of Charlotte (Downtown Motel action). Defendant Gilchrist, as District Attorney, also engaged him to file a public nuisance action against Ashak Patel, Mani, Inc., a North Carolina corporation d/b/a Alamo Plaza Hotel Courts, Alamo Plaza Courts & Alamo Amusements, in the City of Charlotte (Alamo action). In both the Downtown Motel action and the Alamo action, plaintiff worked continuously with Gilchrist as District Attorney, with commanders and officers of the Charlotte Police Department, and with an asset forfeiture specialist, in the investigation and preparation of the actions from 1990 through 1993.
Plaintiff also alleges that in the Downtown Motel action, as a result of plaintiffs legal services, an agreement was reached with the owners that closed the Inn and abated the nuisance. In the Alamo action, as a consequence of plaintiff’s legal services, Alamo was found to be a public nuisance and was closed by order of the Superior Court. In both actions, the State benefitted from plaintiffs services and plaintiff expected to be paid for his legal services. In his complaints, plaintiff seeks payment for the reasonable value of his services based on a theory of quantum meruit.
*244In the Alamo action, defendants have admitted in their answer “that the Defendant Gilchrist signed the complaint [against Alamo] as a relator and was aware that Plaintiff did expend efforts with regard to the investigation and preparation of a public nuisance action against the Alamo.” Defendants further admit “that Plaintiffs legal efforts assisted in reaching an agreement with the owners of the property that provided for the abatement of the nuisance.” In addition, paragraph 12 of defendants’ Alamo answer states:
12. . . . Defendant Gilchrist admits that there was an implied understanding with the Plaintiff concerning payment for his efforts in public nuisance actions, including the action against Alamo, under the terms of which the Plaintiff’s payment was to be limited to and contingent upon an award from the trial court pursuant to N.C.G.S. § 19-8 in the public nuisance action, and was to be paid entirely either by the individual or individuals committing the public nuisance or from the proceeds of the sale of property declared to be a nuisance or both.
In this answer, defendants deny there was any other express or implied agreement or understanding between plaintiff and defendants other than that admitted in paragraph 12 of their answer. Defendants have not made similar admissions in the Downtown Motel answer but simply deny plaintiff’s substantive allegations.
The issue presented on appeal is whether these quantum meruit actions are barred under the doctrine of sovereign immunity. Plaintiff contends the actions are not barred because the State consented to be sued when, acting through District Attorney Gilchrist, it engaged plaintiff as an attorney. Defendants contend that consent to be sued on claims sounding in contract extends only to cases in which the State has entered into an express contract and does not extend to quantum meruit actions.
We note that plaintiff has sued both the State of North Carolina and Gilchrist, in his role as district attorney. We first delineate the theories of recovery presented by plaintiff’s allegations. We then address whether sovereign immunity bars plaintiff’s claims against the State and against defendant Gilchrist.
I. Alleged Theories of Recovery
The term “quantum meruit” can denote both a method of measuring recovery in restitution and a substantive theory of relief in restitution. See generally Dan B. Dobbs, Dobbs Law of Remedies *245§§ 4.1(1), 4.2(3) (2nd ed. 1993) (summarizing these principles). As a measure of recovery, quantum meruit refers generally to the reasonable value of services rendered. See Dobbs, § 4.2(3). Quantum meruit type recovery may be obtained for breach of an implied in fact contract and on the substantive theory of a contract implied in law. Suggs v. Norris, 88 N.C. App. 539, 544, 364 S.E.2d 159, 162, cert. denied, 322 N.C. 486, 370 S.E.2d 236 (1988); see also Dobbs, §§ 4.2(3), 12.7(1). An implied in fact contract is a “ ‘real’ ” contract, i.e., a genuine agreement between the parties. Ellis Jones, Inc. v. Western Waterproofing Co., 66 N.C. App. 641, 645-46, 312 S.E.2d 215, 217-18 (1984). “The term, implied in fact contract, only means that the parties had a contract that can be seen in their conduct rather than in any explicit set of words.” Id. at 646, 312 S.E.2d at 218. In contrast, an implied in law contract “is not the product of an agreement between the parties but is imposed by law to prevent unjust enrichment of a defendant when he should not be permitted to retain a benefit that he has received from plaintiff.” Id. at 645, 312 S.E.2d at 217.
The specific type of recovery available varies based on whether the complainant seeks recovery under a theory of implied in fact contract or implied in law contract. Id. at 645, 312 S.E.2d at 217. Under a contract implied in fact theory, “damages are based on the reasonable value of the services ‘rendered pursuant to request and agreement to pay therefor (sic).’ ” Id. at 646, 312 S.E.2d at 218. Under a contract implied in law theory, “the measure of recovery is quantum meruit, the reasonable value of materials and services rendered by the plaintiff that are ‘accepted and appropriated by defendant.’ ” Id. at 647, 312 S.E.2d at 218 (quoting Thormer v. Lexington Mail Order Co., 241 N.C. 249, 252, 85 S.E. 2d 140, 143 (1954)).
In Ellis Jones, this Court determined that the plaintiff’s pleadings and evidence were “broad enough to support the alternative theories of an implied in fact contract and an implied in law contract.” Ellis Jones, 66 N.C. App. at 647, 312 S.E.2d at 218; see also, Thormer, 241 N.C. at 253, 85 S.E.2d at 218 (finding complaint broad enough to support quantum meruit recovery on implied in law contract theory). Similarly here, upon examination of plaintiff’s complaints, we find plaintiff’s allegations in both complaints are broad enough to encompass both implied in fact and implied in law theories of recovery.
II. Claims Against the State
Given this determination, we now examine whether the doctrine of sovereign immunity bars plaintiff’s recovery against the State *246under either or both of these theories. In Smith v. State, 289 N.C. 303, 222 S.E.2d 412 (1976), our Supreme Court held, in an opinion written by Chief Justice Susie Sharp, that “whenever the State of North Carolina, through its authorized officers and agencies, enters into a valid contract, the State implicitly consents to be sued for damages on the contract in the event it breaches the contract.” Smith, 289 N.C. at 320, 222 S.E.2d at 423-24. When this occurs, the State “cannot invoke the protection of sovereign immunity.” Id. at 315, 222 S.E.2d at 421. Contrary to defendants’ contentions, the Court in Smith did not limit its holding to express contracts. Under the analysis applied in Smith, we find no meaningful difference between a valid express contract and a valid implied in fact contract. Both reflect a genuine agreement between the parties. See Ellis Jones, 66 N.C. App. at 645, 312 S.E.2d at 217.
However, the Smith holding is limited to valid contracts, i.e., contracts authorized by law. Smith, 289 N.C. at 320, 322, 222 S.E.2d at 423-24, 425; Stewart v. Graham, Com’r of Agriculture, 72 N.C. App. 676, 677, 325 S.E.2d 53, 54, disc. review denied, 313 N.C. 611, 330 S.E.2d 616 (1985). In Smith, the Court discussed contract validity in terms of legislative authorization for the contract. See Smith, 289 N.C. at 321, 222 S.E.2d at 424 (holding state consents to be sued when it enters into a contract pursuant to legislative authorization).
This limitation raises the question of whether the alleged implied in fact contract for legal services between plaintiff and the State, acting through District Attorney Gilchrist, is valid. In both actions, plaintiff alleges he prosecuted the nuisance actions at the request of Defendant Gilchrist, acting as District Attorney, and that this request was made on the understanding that plaintiff would be paid for this legal service. Thus, we examine whether defendant Gilchrist, acting on the State’s behalf, was authorized to enter into this type of contract with plaintiff.
The office of district attorney is created by Article IV, Section 18 of our North Carolina Constitution. N.C. Const, art. IV, § 18; In re Spivey, 345 N.C. 404, 409, 480 S.E.2d 693, 696 (1997). District attorneys are independent constitutional officers, expressly vested by our Constitution and/or by statute with the responsibility for prosecution of criminal actions and infractions in the superior and district courts of their prosecutorial districts. See N.C. Const, art. IV, § 18; N.C. Gen. Stat. § 7A-61 (1995); N.C. Gen. Stat. § 147-89 (1993); Spivey, 345 N.C. at 409-10, 480 S.E.2d at 696. In addition, the General Assembly, as *247authorized under N.C. Const, art. IV, § 18, has conferred upon district attorneys, private persons, and certain enumerated others, the authority to bring a public nuisance action under Chapter 19 of the N.C. General Statutes in the name of the State of North Carolina. N.C. Gen. Stat. § 19-2.1 (1996). The State, through the district attorney, has not only the authority, but also as an advocate of the State’s interest in protecting society, an implied duty to bring public nuisance actions. See Jacobs v. Sherard, 36 N.C. App. 60, 63, 243 S.E.2d 184, 187, disc. review denied, 295 N.C. 466, 246 S.E.2d 12 (1978).
An elected district attorney “may, in his or her discretion and where otherwise permitted by law, delegate the prosecutorial function to others.” State v. Camacho, 329 N.C. 589, 593, 406 S.E.2d 868, 871 (1991). In criminal prosecutions, a trial court may permit a private prosecutor to appear for the State when the district attorney consents to the employment of a private prosecutor. Id. at 593-94, 406 S.E.2d at 871. This discretion to permit private prosecutors to appear upon a district attorney’s consent “ ‘has existed in our courts from their incipiency.’ ” Id. at 594, 406 S.E.2d at 871 (quoting State v. Best, 280 N.C. 413, 416, 186 S.E.2d 1, 3 (1972)).
Although not identical, a district attorney’s decision to employ private counsel to assist the district attorney in bringing a Chapter 19 nuisance action in the name of the State is similar in many respects to a district attorney’s decision in a criminal action to permit a private attorney to assist. Both decisions derive from and implement the district attorney’s duty to advocate for the State’s interest in the protection of society. Our State Constitution and G.S. §§ 7A-61, 147-89 and 19-2.1 do not prohibit a district attorney from employing private counsel to assist in the manner described in plaintiff’s complaints.
Defendants assert that N.C. Gen. Stat. § 147-17 does limit the district attorney’s authority to contract for legal services on behalf of the State and thereby renders the agreement alleged by plaintiff invalid. This statute provides, in pertinent part:
(a) No department, officer, agency, institution, commission, bureau or other organized activity of the State which receives support in whole or in part from the State shall employ any counsel, except with the approval of the Governor. The Governor shall give his approval only if the Attorney General has advised him, as provided in subsection (b) of this section, that it is impracticable for the Attorney General to render the legal services.
*248N.C. Gen. Stat. § 147-17 (1993). Chapter 147 of the General Statutes is entitled “State Officers.” Article 8 of Chapter 147 lists duties of district attorneys. See G.S. § 147-89. Thus, as state officers under Chapter 147, district attorneys are required to comply with the G.S. § 147-17 prohibition against hiring of counsel absent the Governor’s approval.
Plaintiffs pleadings do not indicate whether Gilchrist obtained the Governor’s approval, as provided in G.S. § 147-17, when he allegedly “engaged” plaintiff to perform legal services. The record also does not show any evidence was presented by the parties to the trial court on this issue. At this stage of the proceedings, we cannot determine whether Gilchrist had the legislative authority to engage plaintiff for legal services and thus, we cannot determine the validity of the alleged implied in fact contract. Therefore, we remand for the presentation of further evidence on this issue. If on remand, the trial court determines plaintiff was retained in violation of G.S. § 147-17, any alleged implied in fact contract between plaintiff and Gilchrist, acting on behalf of the State, is invalid. If the alleged contract is invalid, then the State has not waived sovereign immunity as to plaintiff’s breach of implied in fact contract claim because, under Smith, such a waiver extends only to valid contracts.
The harder question, however, is whether sovereign immunity bars plaintiff’s claims against the State for quantum meruit restitution based on an implied in law contract theory. Since, under Smith, sovereign immunity is only waived for valid contracts, we must examine whether a judicially imposed implied in law contract, under the facts alleged by plaintiff, is valid. We hold, under the principles enunciated in Smith, that it is.
For an implied in law contract, the issue presented is whether a State consents to be sued when it knowingly and voluntarily accepts services of another and is unjustly enriched by these services under circumstances in which the other entity has a reasonable expectation of payment. The New Jersey Supreme Court recently addressed the question of whether a regional sewerage authority’s implied in law quantum meruit claim would lie against a township when statutory contracting procedures were not followed. Wanaque Borough Sewerage Authority v. Township of West Milford, 677 A.2d 747 (N.J. 1996). Although this case does not deal directly with the issue of sovereign immunity, we find its analysis helpful and persuasive in delineating the concerns and equities which warrant judicial imposition of *249an implied in law contract. In upholding the quasi-contract claim, the New Jersey court stated:
‘[A] quasi-contractual obligation is wholly unlike an express or implied-in-fact contract in that it is “imposed by law for the purpose of bringing justice without reference to the intention of the parties ... In the case of actual contracts the agreement defines the duty, while in the case of quasi-contract the duty defines the contract....’” The scope of the duty is a question of law to be decided by the court.
Wanaque, 677 A.2d at 752 (quoting Saint Barnabas Medical Ctr. v. County of Essex, 543 A.2d 34 (1988)) (citations omitted).
In permitting the claim, the Wanaque court examined the nature of the services performed by the party seeking restitution, the extent of the duty the defending party had to perform the services, and the extent to which the defending party was benefitted by the other party’s performance of that duty. See id. at 753.
Similarly here, District Attorney Gilchrist had the duty, as an advocate of the State’s interest in protecting society, to bring public nuisance actions as needed. Jacobs, 36 N.C. App. at 63, 243 S.E.2d at 187. As our Court stated in a previous action brought by plaintiff to recover for these legal services, Whitfield v. Charlotte, No. 9426SC614, plaintiff’s prosecution of the Alamo and Downtown Motel actions “was first and foremost ‘for the benefit’ of the State of North Carolina, which had the duty to bring the actions.” Whitfield v. Charlotte, No. 9426SC614, at 4 (N.C. Court of Appeals, April 4, 1995) (unpublished). Under the principles set forth in Wanaque, principles of fairness require that plaintiff be permitted to maintain his implied in law contract claim for quantum meruit against the State.
This conclusion is consistent with the principles enunciated by our Supreme Court in Smith. The Court emphasized the following factors and concerns: (1) the voluntary nature of a State’s decision to enter into a contract enables the State to estimate its potential liability for breach; (2) denying a party the right to sue a state for breach of contract permits a taking of property without compensation and violates due process; (3) permitting a State to avoid a contract obligation after having induced the other party to expend time and money performing its obligations would constitute a judicial sanction of government tyranny; (4) permitting a State to breach its contract obligations imputes to the State “ ‘bad faith and shoddiness’ foreign *250to a democratic government”; (5) the courts are the proper forum to adjudicate such claims against the State and a petition for relief to the legislature is an inadequate form of relief. See Smith, 289 N.C. at 320, 322, 222 S.E.2d at 423-25.
These same concerns support the legal conclusion that the State waives sovereign immunity when, acting through its authorized agents, it permits itself to be unjustly enriched at the expense of another by knowingly and voluntarily accepting the benefit of that other entity’s labor under circumstances in which the performing entity reasonably expects to be paid. When a private entity acts in this manner, principles of fairness require that the law impose restitution based on quantum meruit under an implied in law contract theory. E.g., Bales v. Evans, 94 N.C. App. 179, 181, 379 S.E.2d 698, 699 (1989); Suggs, 88 N.C. App. at 544, 364 S.E.2d at 162-63. We see no reason why the State should be relieved of this obligation. In light of these principles, we hold the doctrine of sovereign immunity does not bar plaintiff’s action in restitution for quantum meruit recovery based on an implied in law contract theory.
III. Claims Against Gilchrist
Plaintiff seeks to recover against defendants Gilchrist and the State “jointly and severally.” In the caption of his complaints and in his allegations, plaintiff makes claims against Gilchrist “as District Attorney.” It is not clear from plaintiff’s complaints and his brief whether he is seeking to recover against Gilchrist individually or only against the State. However, for the purposes of this appeal only, we construe plaintiff’s complaint as an attempt to recover not only against the State but also against Gilchrist individually. We conclude he may not pursue his claims against Gilchrist, but may only proceed against the State.
In Smith, our Supreme Court stated that the individual defendants in that action were “not parties to the . . . contract upon which plaintiff bases his suit against the State anymore than the president of a corporation is a party to the contract he executes in his official capacity for the corporation.” Smith, 289 N.C. at 332, 222 S.E.2d at 431. The Court further stated:
[W]hen an action for breach of contract to recover lost benefits is brought against the State and the officials who acted for the State in the transaction which is the basis for the suit, the State alone will be liable for a breach of the contract. In such a case, to hold *251the officials liable, a plaintiff must state and prove more than a claim for breach of contract.
Id.
Thus, to the extent that plaintiff seeks to recover against Gilchrist individually under an implied in fact contract theory, he may not do so because his alleged contract for legal services was with the State and for the benefit of the State. The same principles apply to bar plaintiff’s implied in law contract claim for quantum meruit recovery against Gilchrist. As previously stated, the State was the entity that allegedly benefitted by and was unjustly enriched by plaintiffs legal services.
IV. Additional Issues
In their brief, defendants raise a number of other issues unrelated to sovereign immunity, the single issue on appeal. N.C.R. App. P. 10(b)(1) (1997) provides:
... In order to preserve a question for appellate review, a party must have presented to the trial court a timely request, objection or motion, stating the specific grounds for the ruling the party desired the court to make if the specific grounds were not apparent from the context. It is also necessary for the complaining party to obtain a ruling upon the party’s request, objection or motion.
Since these other matters were not ruled upon by the trial court, and, therefore, are not properly before us, we decline to discuss them further.
V. Conclusion
As to the dismissal of plaintiff’s claims against defendant Gilchrist, the trial court order is affirmed. As to the dismissal of plaintiff’s claims against defendant State of North Carolina, the trial court order is reversed and the case remanded.
Affirmed in part, reversed in part, and remanded.
Judges JOHN and SMITH concur.