
624 S.W.2d 474 (1981)
The FIRST NATIONAL BANK OF KANSAS CITY, and Sam C. Sherwood, John D. Petterson, Loren J. Duensing, Trustees Under the Last Will and Testament of Margery M. Smith, Deceased, Plaintiffs-Respondents,
v.
Mary Hearne CHRISTOPHER, Defendant-Appellant, and
The Unknown and Unborn Heirs, Grantees or Successors of Margery M. Smith, Deceased; of Madeleine Smith, Deceased; and of Mary Hearne Christopher, Defendants-Respondents.
No. WD 31500.
Missouri Court of Appeals, Western District.
October 6, 1981.
Motion for Rehearing and/or Transfer Overruled and Denied November 10, 1981.
Application to Transfer Denied December 14, 1981.
*475 William H. Sanders, John K. Brungardt, Blackwell, Sanders, Matheny, Weary & Lombardi, Kansas City, for defendant-appellant.
George H. Charno, Jr., Kansas City, for plaintiffs-respondents.
Howard A. Crawford, Lathrop, Koontz, Righter, Clagett, Parker & Norquist, Kansas City, for defendants-respondents.
Before MANFORD, P. J., and DIXON and NUGENT, JJ.
Motion for Rehearing and/or Transfer to Supreme Court Overruled and Denied November 10, 1981.
NUGENT, Judge.
Mary Hearne Christopher, the life estate beneficiary of her grandmother's trust, appeals *476 from the order of the circuit court sustaining motions to dismiss her petition seeking distribution of the accumulated income of the trust and distribution of such portion of the corpus of the trust as the court deemed fair. The motions to dismiss were filed by the trustees and the attorney for the unknown and unborn heirs, grantees, or successors of Margery M. Smith, Mary's grandmother, Madeleine Smith, Mary's mother, and Mary. We affirm the trial court's dismissal of the petition.

I.
After a tedious examination of the twenty-year history and record of the case, we find the following to be relevant to our considerations.
On October 6, 1961, the original plaintiffs in this case filed a petition for a declaratory judgment in the circuit court of Jackson County.[1] The plaintiffs were the trustees under the will of Margery M. Smith dated February 22, 1950. She was the widow of John Henry Smith, an executive and stockholder of the Kansas City Title Insurance Company. On her death in December, 1952, she was survived by her daughter, Madeleine Smith, an original defendant herein, and her granddaughter, defendant Mary Hearne Christopher, who was born on March 12, 1949.
In her will Mrs. Smith bequeathed all of her personal property (exclusive of money and securities) to Madeleine Smith. The will then provided in Article III that the remainder of her estate be placed in trust[2] and directed the trustees to make monthly payments of $750 from the trust income to Madeleine for life. Upon Madeleine's death the payments were to be made to Mary during her life. The terms of the trust authorized the trustees, in their discretion, to pay additional sums from the trust income or principal to any beneficiary "in the event of illness, accident or other misfortune, or in the event of any emergency, if in the judgment of the trustees it is necessary for the comfortable maintenance, support or education of any such beneficiary of her family ...." The will declared: "This is a trust primarily for maintenance ...."
When Madeleine requested an increase in the allowance for her comfortable maintenance the trustees in the 1961 action asked the court to direct them in their fiduciary capacity, to construe the will and to declare the rights and responsibilities of the parties thereto. Named as defendants were the unknown and unborn heirs, grantees or successors of Margery M. Smith, Madeleine Smith, and Mary Hearne Christopher, then twelve years old. Her father, Hearne Christopher, was appointed her guardian ad litem. Madeleine's amended answer prayed the Court to find that $750 was not sufficient for her needs, that the testatrix's intent was that the trustees pay additional sums of money to Madeleine for her comfortable maintenance and support, and that, in the proper exercise of the discretionary powers of the trustees, $1500 per month should be paid to Madeleine. Mary's answer admitted all allegations of fact in the trustees' petition, stated that she did not have sufficient knowledge or information to form a belief as to the allegations of Madeleine's demand or the authority of the trustees to comply with that demand, and prayed for the judgment of the court with *477 respect to the matters set forth in the trustees' petition.
We note that the 1962 deposition of Madeleine indicates no close relationship between Mary and her mother or her grandmother. After her parents' divorce in 1950, Mary was in the physical custody of her father, a person of prominence in the community and a member of a family of reputed affluence and active in the grain brokerage business.
In its judgment entry of August 28, 1963, the court found that the trustees were authorized to pay such additional sum over $750 as in their sole judgment was necessary for comfortable maintenance of beneficiary defendant Madeleine Smith, that the trustees had not abused their discretion and the decision to pay additional allowances for defendant's maintenance was solely within their discretion and that the court did not have jurisdiction to order the trustees to increase such amount. Further, the court found that in fact an additional allowance of $500 per month for the comfortable maintenance of defendant Madeleine Smith would be proper and appropriate and under the facts such payment out of the income or the principal would be fully justified in the exercise of the trustees' discretion. The court instructed the trustees that they might in their discretion increase Madeleine's allowance to $1250 and reserved jurisdiction of the action for "such other and further orders as may be necessary or appropriate in the premises." No one appealed from that final order.
On May 19, 1969,[3] the plaintiffs filed a petition for supplemental relief on declaratory judgment again asking the court to declare the rights and duties of the parties in regard to Madeleine's demand for an increase in allowance to $2,000 a month. Mary, through her guadian ad litem, admitted that the earlier judgment "provided that the trustees are authorized by the terms of the will of Margery Smith, deceased, to pay to or for the benefit of Madeline [sic] Smith such additional sums, from time to time, as in their sole and absolute discretion are necessary ...." Madeleine's answer stated that the trustees were authorized to comply with her demand and admitted that the court was empowered to direct the trustees and to declare the rights and responsibilities of the parties. In its judgment entry of July 16, 1969, the court again found that the trustees had authority and discretion to pay such additional amounts to Madeleine Smith and had not abused their discretion in determining amounts theretofore paid. The court noted that it did not have jurisdiction upon the record in this case to order the trustees to increase such allowances. Finding that an additional allowance of $750 per month (bringing the total to $2,000) for the comfortable maintenance of Madeleine Smith would be proper and appropriate under the facts and circumstances, the court reserved jurisdiction as it had earlier, adding that such jurisdiction was not restricted "to additional sum or sums for the comfortable maintenance and support of Madeleine Smith ...." Again, no party sought appellate review.
In April, 1975[4] Madeleine advised the trustees of her demand for an increase in her allowance to $3,400 a month. Predictably, the trustees responded by filing a second petition for supplemental relief on declaratory judgment asking the court to declare the rights and duties of the parties in regard to the new demand. Madeleine's answer was essentially the same as it had been in the two previous actions. Because Mary Christopher was no longer a minor, the court dismissed her guardian ad litem, allowing her to file her own response. She *478 answered, denying the allegations of the petition that uncertainty existed as to the trustees' authority to increase the monthly allowance to Madeleine Smith and alleged in further answer "that the demand of said Madeleine Smith is reasonable and that the trustees in their discretion should increase the payment for her regular allowance to $3,400 as demanded by said Madeleine Smith." She prayed judgment "requiring plaintiffs to increase the regular allowance to Madeleine Smith from $2,000 ... to $3,400 ...." (Emphasis added.) As they had before, the parties submitted the case to the court on the pleadings and discovery without a hearing. On September 19, 1975, the court again found that it did "not have jurisdiction upon the record in this case to order the trustees to increase such allowance." The court instructed and directed the trustees that they were authorized and might, "in their sole and absolute discretion, increase the regular monthly allowance paid to said Madeleine Smith for her comfortable maintenance and support." No one appealed from that order.
After Madeleine's death in 1978, Mary Christopher submitted to the trustees a request for $5,450 a month, $4,700 over the $750 minimum monthly allowance set by the terms of the trust. On January 23, 1979,[5] the trustees filed their third petition for supplemental relief on declaratory judgment asking the court for directions. Mary's attorney advised the trial judge that on December 22, 1978, he had filed a separate declaratory judgment action on Mary's behalf which was then pending in another division of the Jackson County Circuit Court. Mary then filed a motion to dismiss the trustees' action. The court overruled it on May 2, 1979. In the interim Mary's separate action was dismissed, and she filed her "petition" in this original trustees' action, No. 638432. On October 16, 1979, she filed a first amended petition which in Count I prayed for a judgment that she was entitled to the "amount of the accumulated income of the trust in excess of the amount required for reasonable reserves for trust expenses and stabilizing income" and, in Count II, for a judgment "directing the trustees to distribute such portion or all of the accumulated income and corpus of the trust as the court deems fair and just under the circumstances." The trial court sustained the separate motions of the trustees and the unknown and unborn heirs, grantees or successors to dismiss that petition.
Since this appeal was filed, the trial court has found that the trustees are "justified, in the exercise of their discretion, in paying to or for the benefit of Mary Hearne Christopher... the additional sum of $2105 per month effective as of September 7, 1978, (the date Mary Hearne Christopher became a beneficiary of the trust estate) ... making a total monthly payment of $2855." The trial court also found that the trustees would be justified in making additional increased payments to Mary, said increase to be computed on a semi-annual basis, in accordance with any increase in the cost of living "which may be reflected in the Consumer Price Index published by the U.S. Department of Labor." As in the past, the court retained and reserved jurisdiction of this action.

II.
"The scope of review of the motions to dismiss requires an examination of the pleadings allowing them their broadest intendment, treating all facts alleged as true, construing the allegations favorably to plaintiff, and determining whether, upon that basis, the petition invokes principles of substantive law." Porter v. Crawford & Co., 611 S.W.2d 265, 266 (Mo.App.1980). Even under a standard of review so favorable to her, we find that the principles of res judicata bar Mary's claims.
The courts in this and other jurisdictions have long since determined that res judicata applies as well to rulings of law and *479 findings of fact in prior adjudications. The purpose of the doctrineto bring an end to litigationtestifies to the need to apply the doctrine to both legal and factual conclusions and findings.

III.
In 1975 the circuit court entered judgment on the trustees' second petition for supplemental relief in which Mary raised the issue of the court's authority to require the trustees to increase the regular allowance to the beneficiary of the trust, then her mother, in whose place as beneficiary Mary now stands. That prayer was essentially the same as the claim Mary now asserts, that is, that the trustees had no discretion to accumulate surplus income in the way they have always done and continue to do. The 1975 decree held, however, that the trustees had such discretion and that the court had no jurisdiction to direct the trustees as to how to exercise their discretion, that is, "to order the trustees to increase such allowance."
That judgment was a final appealable judgment rejecting Mary's claim as to a matter which she raised and in which she had a contingent interest. No essential distinction exists between that issue and the issue raised by Count I of her present petition. She did not appeal from the 1975 judgment, therefore, it became the final judgment as between the trustees and her on that issue. State Board of Registration for the Healing Arts v. Masters, 512 S.W.2d 150, 159 (Mo.App.1974). Moreover, in Munday v. Thielecke, 483 S.W.2d 679, 681-82 (Mo.App.1972), the court held:
Under what is called estoppel by judgment a final adjudication is conclusive in subsequent proceedings not only as to every issue of fact which was actually litigated, but also as to every issue of fact which might have been.... And when defendant filed and presented his motion of April 2, 1971, the trial court was entitled to take judicial notice that the defendant had filed a similar motion on April 4, 1970, that it had been overruled, and that defendant had not appealed after the judgment became final, for all of such matters were apparent on the face of the court's own records .... (Emphasis added; citations omitted.)
Although neither the trustees nor the unknown and unborn heirs, grantees or successors pleaded res judicata as an affirmative defense in their motions to dismiss, this court takes judicial notice of and considers the record of all the proceedings below. The trustees and the unknown and unborn heirs were not required by the Rules of Civil Procedure to raise the issue of res judicata in their motions to dismiss. To do so would be permissible, but res judicata is an affirmative defense which in this proceeding is still available to those parties if and when they are required to respond to Mary's petition. Hamilton v. Linn, 355 Mo. 1178, 200 S.W.2d 69, 71 (1947); Rule 55.08 and Rule 55.27. On this appeal, however, this court has the right and the duty on its own motion to take judicial notice of the entire record of the trial court and to consider the three earlier judgments of that court in this action between the same parties on the same facts seeking the same reliefconstruction of the powers and duties of the trustees under the will of Margery Smith. Se-Ma-No Electric Cooperative v. City of Mansfield, 321 S.W.2d 723, 730 (Mo.App.1958).
We, therefore, sustain the judgment of the trial court consistent with the rule that a judgment must be affirmed if it is sustained on any theory which the pleadings or record support even if not articulated by the trial court. May Department Stores Co. v. County of St. Louis, 607 S.W.2d 857, 869 (Mo.App.1980). Moreover, in view of our holding herein with respect to Count II, we are convinced that the trial court's dismissal was also correct on the merits.

IV.
Count II of defendant's "petition" alleged that changes in circumstances beyond what the testatrix would reasonably have anticipated have taken place, that is, the accumulation of surplus income. Accordingly, Mary asks the court to direct the *480 trustees "to distribute to such proportion or all of the accumulated income and corpus of the trust as the court deems fair and just under the circumstances." The testatrix's primary intent, however, clearly was to provide for the comfortable maintenance of her daughter and grandchild or grandchildren. In fact, the trustees have done that. On every occasion when a beneficiary asked for an increase in the monthly payment, the trustees have given it. Over and above those payments, all medical, legal and accounting and business expenses have been provided for or calculated into monthly allowances. Deviation is sought because, Mary asserts, changes of circumstances have occurred, unforeseen by her grandmother, which would and do cause strict compliance with the terms of the trust to frustrate its purpose. The history of the administration of the trust belies Mary's assertion.
In Thomson v. Union National Bank in Kansas City, 291 S.W.2d 178 (Mo.1956), the court held at 183 that:
... if by reason of circumstances not known to or anticipated by the settlor strict compliance with the terms of the trust would defeat or substantially impair the accomplishment of the purposes of the trust a court of equity has the power to authorize a deviation from its express provisions. The power to permit deviation, however, is an emergency power, only used to prevent a serious failure in the accomplishment of trust purposes. The terms of this will which create the trust, and are binding on both the executor and the trustee, are plain and unambiguous and there is no manifest intention on the part of the settlor that the trustee was to exercise his discretion and adjust his conduct to changed circumstances. The power to authorize deviations is exercised, primarily, in matters of administration and does not extend to the extinction or reduction of the interests of other beneficiaries. So, as to encroachment upon the principal in favor of the life beneficiary, "When the inquiry is merely the one of basic disposal, the conclusion that none of the corpus is given to the income beneficiary ends his claim." (Citations omitted.)
See also Seigle v. First National Co., 338 Mo. 417, 90 S.W.2d 776, 781 (1936). The trial court correctly held that the doctrine of deviation is inapplicable in the instant case.
The trustees have been most conservative in exercising their discretion regarding the monthly allowances from income. In fact, one might characterize their performance in that regard as timid considering the growth in value of trust assets. But that growth manifestly was not anticipated by testatrix in a decade when the rate of inflation hovered between one and two percent. More importantly, the conservatism or timidity of the trustees is irrelevant if, nevertheless, they have carried out the primary purpose of the testatrix to provide for the comfortable maintenance of the beneficiaries. Likewise, so long as they have done so, the amount of the accumulation of assets and income is irrelevant and immaterial and does not invoke the doctrine of deviation.
Moreover, under the broad discretion granted these trustees they have a perfect right to anticipate that, just as an exceedingly rapid and unanticipated increase in value of the chief asset of the trustthe stock of the Kansas City Title Insurance Companyoccurred in the 1950s and 1960s, so may an equally dramatic deflation occur in the value of that and all other trust assets. Thus, they have the discretion to be conservativeeven timidso long as they also serve the primary purpose of testatrix.

V.
Throughout the life of this trust the trustees have been most reluctant to exercise their discretion without specific guidance from the court. The Supreme Court in Mercantile-Commerce Bank & Trust Co. v. Morse, 356 Mo. 336, 201 S.W.2d 915 (1947), held at 923 that "[a] court in a proper case always has the power to instruct a trustee whether a contemplated act lies within the trustee's discretion.... After such fact is determined, the exercise of the discretion is *481 a matter for the trustee." In Bolles v. Boatmen's National Bank of St. Louis, 363 Mo. 949, 255 S.W.2d 725 (1953), the court at 732 quoted with approval § 187 of the Restatement of Trusts at 479 which states: "When discretion is conferred upon the trustee with respect to the exercise of a power, its exercise is not subject to control by the court, except to prevent an abuse by the trustee of his discretion."
Beyond doubt in the exercise of its general supervisory powers over trusts administered within its jurisdiction a court of equity has the authority to instruct and advise trustees as to their powers and duties. Under circumstances in which a trustee has a reasonable doubt as to the proper disposition of trust property, for his own safety he has a right to apply to a court of equity for directions, joining as parties all persons having an interest in the trust and the disposition of its property. State ex rel. St. Louis Union Trust Co. v. Sartorius, 350 Mo. 46, 164 S.W.2d 356, 359 (en banc 1942).
The exercise of that equity power, however, does not require or permit a court to act as legal advisor to the trustees. McEntee v. Halloran, 391 S.W.2d 266, 268 (Mo.1966). The purpose of the legal guidance of the trustees by the court is to protect them' in those situations where the advice of competent lawyers is not sufficient protection because of doubtful meaning of the trust instrument or uncertainty as to the proper application of the law to the facts. Id.
If ever in the history of this case the trustees truly needed guidance as to the extent of their discretion and powers to disburse funds from corpus and income, such questions have long since been answered. Any danger or risk in the trustees' reliance upon the advice of competent counsel as to the exercise of that discretion long ago dissipated. One reason is that if Mary Christopher ever had a cause of action against the trustees for abuse of their discretion in the accumulation or the disbursement of trust funds in the way they have for almost thirty years, she no longer has that cause of action. Even assuming one could discern a distinction between Mary's claim in Count II and all of the claims for relief in the earlier confrontations with the trustees, her failure to pursue such a claim then precludes her doing so now. For that reason if no other the trial court was correct in dismissing Count II. Goedecke v. Gralnick, 354 Mo. 478, 190 S.W.2d 218, 223 (Mo. en banc 1945). Accord: Smith v. Preis, 396 S.W.2d 636, 640 (Mo.1965); Abeles v. Wurdack, 285 S.W.2d 544, 546 (Mo.1955); Gerhardt v. Miller, 532 S.W.2d 852, 854 (Mo.App.1975); Munday v. Thielecke, supra.
For the foregoing reasons, we affirm the judgment of the trial court.
All concur.
NOTES
[1]  The case was entitled Eisenman, et al., Plaintiffs v. Madeleine Smith, Mary Hearne Christopher and the Unknown and Unborn Heirs of Margery M. Smith, deceased, Madeleine Smith and Mary Hearne Christopher. The case was numbered 638432 in the circuit court which number it retains to this day, although, by a 1979 order of court the case was retitled "First National Bank of Kansas City, Sam C. Sherwood, John D. Petterson and Loren J. Duensing, Trustees under the Last Will and Testament of Margery M. Smith, deceased, Plaintiffs vs. Mary Hearne Christopher and the Unknown Heirs, Grantees, or Successors of Margery M. Smith, deceased, of Madeleine Smith, deceased, and of Mary Hearne Christopher, Defendants." The changes reflect resignations and deaths of trustees and the death in 1978 of Madeleine Smith.
[2]  The trustees' answers to interrogatories show the assets of the trust had a market value of $255,630.30 on April 29, 1954. On September 21, 1961, the trust estate had a market value of $1,379,984.04.
[3]  In their answers to interrogatories of the attorney representing the unknown and unborn heirs, the trustees stated that as of January 15, 1969, the market value of the trust was $1,928,074.27 and the accumulated net income was $259,184.07.
[4]  The approximate value of the trust assets was $2,160,274.01 as of July 15, 1975, according to the trustees' answers to interrogatories of the attorney representing the unknown and unborn heirs. At that time the total value of reinvested accumulated net income was $442,395.34.
[5]  In their May 12, 1979, answers to Mary's interrogatories the trustees reported the market value of the principal of the trust estate to be $1,916,155.72 and the market value of the accumulated income to be $593,342.22, a total of $2,509,497.94.
