
62 Cal.App.4th 1077 (1998)
VETERANS OF FOREIGN WARS, POST 10965 et al., Plaintiffs, Cross-defendants and Appellants,
v.
CITY OF EL PASO DE ROBLES, Defendant, Cross-complainant and Respondent.
Docket No. B111335.
Court of Appeals of California, Second District, Division Six.
April 2, 1998.
*1078 COUNSEL
Paul M. Posner for Plaintiffs, Cross-defendants and Appellants.
McDonough, Holland & Allen and Iris P. Yang for Defendant, Cross-complainant and Respondent.
*1079 OPINION
YEGAN, J.
In Ben-Zvi v. Edmar Co. (1995) 40 Cal. App.4th 468, 475 [47 Cal. Rptr.2d 12], we said what seems to be obvious: "The purpose of the law of contracts is to protect the reasonable expectations of the parties." As we shall explain, this observation applies to conveyances of land and compels reversal of the judgment. Veterans of Foreign Wars, Post 10965 and the American Legion Post 50 appeal from a judgment declaring that the City of El Paso de Robles (City) has no duty to maintain, repair, or replace the Paso Robles Veterans Building. We conclude that City has such an obligation, or in the alternative, to dedicate a substitute facility.

Facts and Procedural History
This action for declaratory relief was filed in 1993 after City closed the Paso Robles Veterans Building for safety reasons and claimed lack of funds to repair the building. A brief history of how the building came to be built is as follows.
On December 3, 1928, the trustees of the Robert Lionel Webster Post No. 50 American Legion conveyed the property at the corner of Fourth and Spring Streets in Paso Robles to the County of San Luis Obispo (County). County adopted a resolution to purchase the property for the purpose of providing and maintaining "a building to be used as a memorial hall and meeting place by all veterans under the provisions of then Section 4041f of the Political Code." County constructed a two-story, twelve-thousand-square-foot building and called it the Veterans Memorial Building.
In 1972, County sold the Paso Robles County Airport and the Veterans Memorial Building to City for $1. The quitclaim deed described the property "as the Paso Robles Veterans Memorial Building, 406 Spring Street, Paso Robles."
After the sale, City leased part of the building to the County Health Department. Part of the upstairs area was used by veterans' organizations for meetings once or twice a week. By 1990 the building was in serious disrepair. Appellants requested that City fix the roof leaks, repaint the interior, and repair the heating system. City made no repairs.
In 1992 appellants complained about the presence of asbestos and that the building did not meet earthquake safety standards and the requirements of the American with Disabilities Act. (42 U.S.C § 12101 et seq.). City retained a consultant who estimated that it would cost $520,000 to remove the *1080 asbestos and retrofit the building. City estimated it would cost an additional $350,000 to remodel and enhance the facilities.
On August 1, 1993, City closed the building due to safety concerns and claimed lack of funds to repair the building. Before doing so, it offered appellants free use of other city-owned facilities for meetings and future events.
Appellants filed suit for declaratory relief, alleging that the building closure violated section 1262 of the Military and Veterans Code. The complaint prayed for judgment declaring that City must maintain and repair the building, or in the alternative, construct a substitute memorial facility. City filed a cross-complaint for declaratory relief, alleging that it had no such duty.

Trial Court Ruling
The trial court heard two days of testimony, took the matter under submission and issued a notice of intended decision, which stated: "The statutory provisions  Military and Veterans Code, sections 1262 and 1266  upon which plaintiffs seek to rely for the duty of the defendant, CITY OF EL PASO DE ROBLES, to continue to provide and maintain the Paso Robles Veteran's Memorial Building, are directed to the County rather than the City. Accordingly, the defendant, THE CITY OF EL PASO DE ROBLES, has no legal obligation to provide and maintain the Paso Robles Veteran's Memorial Building for plaintiffs." Judgment was entered for City.
(1a) There is no question but that Military and Veterans Code sections 1262 and 1266 (see, post) are directed solely to the County. However, the fabric of the law with respect to dedicated veterans' buildings is much broader than the literal language of these two statutes.

He Who Takes the Benefit Must Bear the Burden
(2) "A voluntary acceptance of the benefit of a transaction is equivalent to a consent to all the obligations arising from it, so far as the facts are known, or ought to be known, to the person accepting." (Civ. Code, § 1589.) "He who takes the benefit must bear the burden." (Civ. Code, § 3521.) These principles have application in real estate transactions. (Thompson v. Swiryn (1950) 95 Cal. App.2d 619, 630-631 [213 P.2d 740].) As a general rule, the grantee of a quitclaim deed takes subject to all equities that could have been asserted against the grantor. (4 Witkin, Summary of Cal. Law (9th ed. 1987) Real Property, § 135, p. 351; Allison v. Thomas (1887) 72 Cal. 562, 564-565 [14 P. 309].)
*1081 (1b) City claims that it purchased the property free and clear of any obligation to maintain, repair, or replace the building. The argument is based on a literal reading of Military and Veterans Code section 1262. This section provides: "Any county may provide, maintain or provide and maintain buildings, memorial halls, meeting places, memorial parks, or recreation centers for the use or benefit of one or more veterans' associations. For these purposes the board of supervisors of any county may: [¶] ... [¶] (h) Join with any incorporated city in the county in the accomplishment of the above purposes and to that end hold jointly with such city all property acquired, and expend money in conjunction with such city in accomplishing the above purposes. Title to any property jointly so acquired by a county and a city may at any time be conveyed by either of the joint owners to the other without consideration other than to carry out the purposes of this section."
City argues that there was no joint agreement with County within the meaning of Military and Veterans Code section 1262, and thus it has no duty to maintain the building. As we shall explain, this argument ignores the big picture.
When the veterans conveyed the property to the County in 1928, they had a reasonable expectation that a veterans' building would be provided and maintained. This expectation was met by County until 1972 when City acquired ownership of the property. The City knew, or should have known, that the property had a burden. (Civ. Code, § 1589.) This burden was provided in 1928 by the Court of Appeal in Gridley Camp No. 104 v. Board of Supervisors (1929) 98 Cal. App. 585 [277 P. 500]. In 1989 the Legislature codified the Gridley Camp holding.[1]
When City acquired the property in 1972, it had a reasonable expectation that it was acquiring a valuable parcel of real property. It could use the building for its own purposes, provided that it maintained the building for reasonable use by the veterans. City used the building for over 20 years while at the same time providing for the veterans. Thus, all of the parties' *1082 reasonable expectations were met. That all changed in 1993 when City closed the building.
City's 1993 repudiation of its obligation to maintain the veterans' building while at the same time claiming fee simple ownership is more than unfair. It is unconscionable. Even though the building is unsafe, the land has value. Just how City is entitled to the favorable aspect of its 1972 bargain without providing for the veterans has not been explained in the briefs or at oral argument. When the City purchased the dog, it also purchased its tail. It could not take the benefit without the burden.
The trial court did not find that County's quitclaim deed revoked the dedication or that the veterans abandoned use of the facility. For the reasons here articulated, it could not do so.

Government Code Section 37461
Government Code section 37461 et seq., which is similar to Military and Veterans Code section 1262, provides a separate and distinct basis for our conclusion that City has a duty to maintain the veterans' building. Government Code section 37461 states in pertinent part: "A city may provide and maintain ... buildings, memorial halls, and meeting places for veterans' patriotic, fraternal, and benevolent associations."
While the language of Government Code section 37461 is permissive, i.e., it uses the word "may," similar language was construed in Gridley Camp to mean that once a government entity dedicates a veterans' memorial, it has a mandatory duty to maintain it. (Gridley Camp No. 104 v. Board of Supervisors, supra, 98 Cal. App. at p. 597.) There is no good reason to construe the language of Government Code section 37461 differently than Military and Veterans Code section 1262. Thus, we hold that when a city elects to purchase a dedicated veterans' building, it assumes a mandatory duty to maintain, repair, or replace the building or, in the alternative, to dedicate a substitute facility pursuant to Government Code section 37461. When the City complies with our decision, the reasonable expectations of all of the parties will again be met. The late trustees of the Robert Lionel Webster Post No. 50 American Legion, who provided the land for all future veterans, may now rest easy.

Conclusion
We need not decide how City is to discharge its obligation. The appropriate remedy is, in the first instance, addressed to the sound discretion of *1083 the trial court. We express no opinion on how that discretion should be exercised.
The judgment is reversed. Costs to Appellants.
Stone (S.J.), P.J., and Gilbert, J., concurred.
A petition for a rehearing was denied April 28, 1998.
NOTES
[1]  Military and Veterans Code section 1266 provides: "Whenever a county has provided, maintained, or provided and maintained any building, memorial hall, meeting place, memorial park, or recreation center for the use or benefit of one or more veterans' associations, pursuant to Section 1262, the provision of that facility and its acceptance by the veterans' association constitutes a dedication of that property to a public purpose, and the county may not revoke the dedication, so long as the veterans' association has not violated the terms and conditions of the dedication, unless it dedicates substitute facilities or unless the veterans' organization has either consented to the proposed county action or has abandoned its use of the facilities."

Section 2 of Statutes 1989, chapter 102, at page 933 provides: "It is the intent of the Legislature, in enacting Section 1266 of the Military and Veterans Code, to codify the holding of the court in the case of Gridley Camp No. 104 v. Board of Supervisors, 98 Cal. App. 585."
