Opinion
Plаintiffs appeal from an order granting their ex parte motion to dismiss their action pursuant to Code of Civil Procedure section 581 1 following the sustaining of defendant’s demurrer to plaintiffs’ amended complaint with leave to amend.
The action is a class action brought by plaintiffs on behalf of themselves and others similarly situated who have or will have their convictions under Vehicle Code section 23102, subdivision (a), (misdemeanor drunk driving) declared unconstitutional, seeking to establish and enforce a constructive trust naming defendant (State of California) trustee of money paid to the state pursuant to said convictions, alleging that defendant is wrongfully withholding their money, and seeking to impose a constructive trust in order to prevent unjust enrichment.
A demurrer to the complaint was interposed by defendant on several grounds. The demurrer was sustained on the ground that it failed to allege compliance with the presentation of claims against the state as provided for in Government Code section 905.2. Plaintiffs amended their complaint alleging compliance with Government Code section 905.2. Defendant demurred to the amended complaint on substantially the same grounds urged in its demurrer to the original complaint. The grounds of the demurrer set forth were (1) that plaintiffs have not properly complied with the claims filing provisions of the California Government Code; (2) that the state is immune; (3) that a finding that a prior conviсtion is constitutionally invalid does not require a refund of the fines and penalty assessments; (4) that there is a misjoinder of parties *627 in that the allegations of the complaint do not establish facts necessary to constitute a class action; and (5) that the complaint is uncertain in that it does not make clear whether the convictions that have been and will be declared unconstitutional were or will be declared unconstitutional on appeal or on the basis of collateral attack, and in that it fails to set forth when the alleged causes of action arose, when the setting aside of previous convictions occurred, or when the filing of the claim with the State Board of Control was made. The demurrer was sustained, with leave to amend, on all the grounds set forth in the demurrer. Plaintiffs chose to stand on the amended complaint.
Plaintiffs first contend that the trial court, having sustained the demurrer to the original complаint on only one ground, erred in sustaining the demurrer to the amended complaint on grounds identical to those raised by the first demurrer. They contend that the trial court impliedly overruled all grounds of the first demurrer which it did not specifically sustain and that, therefore, defendant was estopped from relitigating the issues already determined.
Reliance is placed by plaintiffs on section 472d of the Code of Civil Procedure which provides: “Whenever a demurrer in any action or proceeding is sustained, the court shall include in its decision or order a statement of the specific ground or grounds upon which the decision or order is based which may be by reference to appropriate pages and paragraphs of the demurrer.” This section has been interpreted, however, to require affirmance of trial court’s rulings on demurrers if any of the grounds raised by the defendant require the sustaining of the demurrer, whether or not the court spеcifies all the grounds.
(Banerian
v.
O’Malley,
Adverting to the amended complaint we perceive it as one purporting to state a cause of action based on implied contract where the mutual obligations of the parties are implied by their conduct. (Civ. Code, § 1621.) “The doctrine of implied contracts has its foundation in
*628
the doctrine of unjust enrichment. [Citation.]”
(McCaffrey
v.
Cronin,
The doctrine of unjust enrichment is applied in cases where a party is entitled to restoration of benefits lost by virtue of an erroneous judgment. Thus, it is the rule that upon reversal of an action a court has power to restore benefits upon the rationale that a reversal of the judgment places the action in the posture as though it had never been tried. In such a situation the court will, where justice requires it, place the parties as nearly as may be possible in the condition in which they stood previously.
(Schubert
v.
Bates,
In California, as applied to criminal cases, it is specifically provided by statute that fines are to be returned to the defendant if the judgment is reversed and the case is dismissed or if the appellate court directs a final disposition of the action in the defendant’s favor. (Pen. Code, § 1262. 2 )
Defendant’s characterization of the action as one in tort so as to bring it within the provisions of the public entity tort claims statutes (Gov. Code, § 810 et seq.) is inaccurate. Nothing in those statutes affects liability based on contract or the right to obtain relief other than money or damages against a public entity or public employee. (Gov. Code, § 814;
National Automobile & Cas. Ins. Co.
v.
Pitchess,
Adverting to the ground of demurrer that there is a misjoinder of parties in that the аllegations of the complaint do not establish facts necessary to constitute a class action, we conclude that the demurrer was properly sustained on this ground on the basis that there is not a cognizable and manageable class of plaintiffs and that the utilization of a class action suit will not serve the ends of justice. (See
Vasquez
v.
Superior Court,
In
Bacom
v.
County of Merced,
The demurrer in
Bacom
was interposed on several grounds including the ground that the complaint did not state facts necessary to state a class action. The sustaining of the demurrer without leave to amend was upheld by the appellate court on this ground. (
*630
We agree with the rationale of
Bacom.
The facts allegеd in the instant complaint, encompassing a far greater number of plaintiffs than those in
Bacom
and purporting to include plaintiffs who may be similarly situated in the future, rather than those whose claims fall within a specified period as in
Bacom,
clearly present a situation involving an unmanageable class and one that can create more problems than it can solve. The type of class action pleaded in the present case is not one the maintenancе of which will be of substantial benefit to
both
the litigants and the courts. Under these circumstances a class action is inappropriate. (See
Blue Chip Stamps
v.
Superior Court,
We are thus left with a consideration of the allegations of the complaint insofar as they concern the individually named plaintiffs who have purported to bring the action on behalf of themselves as well as those asserted to be similarly situated. These plaintiffs allege that they are individual members of the alleged class and that their interests are affected in the same manner as the interests of all members of said class are affected. As respect themselves, these plaintiffs allege that they were convicted of a violation of California Vehicle Code section 23102; that as part of the sentences imposed they werе ordered to pay a fine or penalty or fine and penalty; that subsequent to the date of their conviction courts in this state have declared their convictions unconstitutional and void; that defendant has retained and continue to retain monies paid by said plaintiffs as a fine or penalty or a fine and penalty; and that defendant has no lawful claim to said money.
Our inquiry is whether the allegations of the individually named plaintiffs state a cause of action. The thrust of defendant’s general demurrer is that the finding that a prior conviction is unconstitutionally invalid does not require a refund of the fines and penalty assessments.
In
Colvig
v.
RKO General, Inc.,
We are of the opinion that in the light of these principles the complaint of the individually named plaintiffs states a cause of action. It alleges a classic case of a cause of action for restitution. The complaint alleges a primary right in these plaintiffs that they be restored the fines and penalties assessed upon their conviction of the specified misdemean- or because the conviction has been found to be void by a court. On the part of defendant the complaint alleges that there is a corresponding duty on its part to return such fines and penalties and that by failing in their duty it has breached plaintiffs’ antecedent primary right. As we have pointed out above, where a criminal сonviction is set aside with the effect of finally disposing of the action, the defendant is entitled to a return of any fine imposed and there is a duty upon the public entity to which the fine was paid to return the fine on the basis that the retention of such monies will result in unjust enrichment. In such case the law creates an obligation because one who obtains a benefit which he may not justly retain is unjustly enriched. (See
Branche
v.
Hetzel,
Adverting to the special demurrer we first take cognizance оf certain applicable principles; “A demurrer for uncertainty will not lie where the ambiguous facts alleged are presumptively within the knowledge of the demurring party. [Citations.] A special demurrer should not be sustained if the allegations are sufficiently clear to apprise the defendant of the issues that must be met, even if the allegations of the complaint may not be as clear and as detailed as might be desired. [Citations.] ... [a] demurrer for uncertainty will not liе as to even uncertain and ambiguous allegations, if such allegations refer to immaterial matters. In such event, they will be treated as surplusage and disregarded. [Citations.]”
(Merlino
v.
West Coast Macaroni Mfg. Co., 90
Cal.App.2d 106, 108 [
*632 As a ground of special demurrer for uncertainty defendant alleged that the complaint does not make it clear whether the convictions that have been declared unconstitutional were declared unconstitutional on appeal or on the basis of collateral attаck. In considering this ground we note that the complaint does not merely allege that the convictions were declared unconstitutional but alleges also that they were declared unconstitutional and void: Defendant seeks clarity on the basis that if the complaint discloses that the convictions were declared constitutionally invalid as the result of a collateral attack plaintiffs cannot state a cause of action.
In view of defendant’s contention we dеem it expedient to point out the distinction between a direct and a collateral attack on a judgment. A direct attack is a proceeding instituted for the specific purpose of vacating, reversing, or otherwise attacking the judgment as by motion for new trial, motion to vacate, appeal, an independent action in equity, and by certiorari or other writs. (5 Witkin, Cal. Procedure (2d ed. 1971) pp. 3584-3585; see
Palmquist
v.
Palmquist,
Defendant, in its arguments, has assumed that the basis of plaintiffs’ claim of constitutional invalidity is predicated on the striking of an alleged prior conviction for misdemeanor drunk driving from the accusatory pleading in a pending criminal proceeding and thus urge that
*633
a collateral attack resulting in such an order does not have the effect of wiping out the prior judgment of conviction. It relies on
People
v.
Burke,
We are unable to ascertain from the complaint whether the individual plaintiffs predicate their cause of action upon constitutional invalidity pursuant to the type of collateral proceeding initiated in
Burke
and
Gonzalez.
We do note, however, that
Gonzalez
points out the distinctiоn between a direct and a collateral attack upon a prior judgment of conviction. Thus it is pointed out that there is a distinction between an attack on a conviction on constitutional grounds by way of a motion to strike allegations of prior convictions from an accusatory pleading in a pending criminal proceeding and that pursuant to a motion to vacate a prior judgment of conviction which must be initiated by the defendant in the аction in which the prior judgment was rendered.
(Gonzalez
v.
Municipal Court, supra,
Gonzalez
points out that a defendant must continue to fulfill the conditions of the sentence imposed upon him as a result of the prior conviction unless he successfully moves to vacate or set aside the judgment in the original action, in which event he may be subject to retrial, notwithstanding that the prior conviction is declared constitutionally invalid in a pending criminal proceeding. (
We perceive that although a conviction may be collaterally attacked on constitutional grounds in order to avoid the effect of the judgment of conviction in a pending proceeding, such avoidance does not have the effect of wiping out the prior judgment of conviction. Such a result may only be achieved upon direct attack. Accordingly, in order to set aside a judgment imposing a fine the underlying conviction upon *634 which such judgment rests must be vacated and set aside by the court in which the prior conviction was obtained and the fine imposed.
It should be noted that a proceeding to set aside or vacate a prior judgment of conviction, if successful, subjects a defendant to a retrial.
(Gonzalez
v.
Municipal Court, supra,
We conclude, therefore, that in order for the individual plaintiffs to state a cause of action it was incumbent upon them to plead that the prior convictions in the instant case were vacated or set aside in the court in which the prior сonviction was obtained and the sentence imposed. Their failure to clearly set forth how or in what manner the convictions were declared constitutionally invalid rendered the complaint vulnerable to demurrer for uncertainty. A similar infirmity is to be found in the failure of the complaint to set forth when the alleged causes of action arose and when the setting aside of the previous convictions occurred. These matters are material to plaintiffs’ cause of action. 5
We observe that these objections of uncertainty would also be grounds for general demurrer because they are uncertainties with regard to matters not alleged which are essential to the cause of action (see
Dumm
v.
Pacific Valves,
We do not perceive that because the nature of the proceeding by which plаintiffs have obtained an adjudication with respect to the validity of the subject convictions and the dates when such adjudications occurred should be a matter of public record, these matters are presumptively within the knowledge of defendant so as to preclude a demurrer for uncertainty. Plaintiff's, apparently relying on the belief that they have a meritorious class action, have joined every county and city in *635 this state as a defendant to this aсtion. It would stretch credulity to assert that each of said defendants is presumed to know the court or jurisdiction in which plaintiffs’ subject convictions have been declared unconstitutional and void.
As respects the ground of special demurrer that the complaint fails to set forth when the filing of plaintiffs’ claim with the State Board of Control was made, we note that the complaint states that such a claim was filed within six months prior to the filing of the amended complaint. Thе amended complaint was filed on January 22, 1975. The amended complaint also discloses by way of exhibit attached thereto that plaintiffs’ claims were denied on November 25, 1974. Accordingly, there is no uncertainty with respect to the filing of the claim. Moreover, the date of the filing of the claim is a matter presumptively within the knowledge of defendant state.
In the instant case plaintiffs were given an opportunity to amend the complaint. They declined to do so. It is the rule that when a plaintiff is given the opportunity to amend his complaint and elects not to do so, strict construction of the complaint is required and it must be presumed that the plaintiff has stated as strong a case as he can.
(Mitchell
v.
National Auto. & Casualty Ins. Co.,
It is also the rule that where the lower court sustains the defendant’s demurrer with leave to amend and the plaintiff declines to do so, electing to stand on his complaint, the judgment of dismissal must be affirmed if the complaint is objectionable on any ground raised by the demurrer.
(Hilltop Properties
v.
State of California,
The judgment is affirmed.
Sims, J., and Elkington, J., concurred.
Appellants’ petition for a hearing by the Supreme Court was denied May 26, 1977.
Notes
Code of Civil Procedure section 581 provides: “An action may be dismissed in the following cases: . . . 3. . . . when, after a demurrer to the complaint has been sustained with leave to аmend, the plaintiff fails to amend it within the time allowed by the court, and either party moves for such dismissal....”
Penal Code section 1262, in pertinent part, provides: “. . . If a judgment against the defendant is reversed and the case is dismissed, or if the appellate court directs a final disposition of the action in defendant’s favor, and defendant has theretofore paid a fine in the case, such act shall also be deemed an order of the court that the fine, including any penalty or assessment thereon, be returned to defendant.”
A hearing was denied by the Supreme Court.
We do not imply that a defendant has an unrestricted right to fines and penalties since he may be subject to certain applicable defenses such as the bar of the statute of limitations. In the present case no issue as to any such defenses is presented.
We note also that plaintiffs do not allege the amounts of the fines and/or penalties assessed for which they seek recovery. However, this element of uncertainty was not specified' as a basis for special demurrer.
