
796 P.2d 150 (1990)
118 Idaho 273
Edward HELLICKSON and Glenna Hellickson, husband and wife, Plaintiffs-Appellants,
v.
Joshua LaVon JENKINS, Deceased, Estate and Merrill Jenkins, Personal Representative, Defendants-Respondents.
No. 18010.
Court of Appeals of Idaho.
July 17, 1990.
Rehearing Denied July 17, 1990.
*151 Dean Williams, Blackfoot, for plaintiffs-appellants.
Moss & Luke, Blackfoot, for defendants-respondents. Colin W. Luke, argued.

SUBSTITUTE OPINION

The Court's prior opinion dated February 26, 1990, is hereby withdrawn.
BENGTSON, Judge, Pro Tem.
This appeal presents a situation where, in considering a motion under I.R.C.P. 12(b)(6) to dismiss for alleged failure of the complaint to state a claim upon which relief can be granted, the trial court considered matters outside of the complaint without converting the motion to one for summary judgment under I.R.C.P. 56, and apparently without giving the parties a reasonable opportunity to present all material pertinent to a summary judgment motion. The trial court's dismissal was affirmed on appeal to the district court. We vacate the order of dismissal and remand the action for further proceedings.
Hellicksons filed a four-count complaint against Merrill Jenkins, the personal representative of the estate of Joshua Jenkins, deceased. In Count I, Hellicksons alleged that they had entered into an oral agreement whereby they agreed to "care for and maintain" certain real property, including a dwelling, in Bingham County and that "in consideration thereof, the defendant [sic][1] agreed to prepare and execute a will transferring and deeding" such real property to them; that they performed their duties under the oral agreement, but that Joshua Jenkins died without having executed a will in accordance with the oral agreement. They prayed that the defendant, Merrill Jenkins, as Joshua's personal representative, be ordered to "transfer to [Hellicksons] by a Personal Representative's Deed title to [the real property] by virtue of the *152 oral agreement between [them] and [Joshua]."[2]
Count II realleged the averments of Count I by reference and further alleged that Joshua and his estate have "received benefit" from Hellicksons' "labor and services" (apparently in caring for and maintaining the real property in question); that Joshua's estate would be unjustly enriched "by [Joshua's] failure to compensate [Hellicksons] for their labor and services" and that the Hellicksons are, therefore, "entitled to receive from the personal representative of [Joshua's] estate a Deed to [the real property in question]."
By Count III, Hellicksons again sought an order directing the personal representative to deed the real property to them. They alleged that appellant Glenna Hellickson (Glenna) is the daughter of W. Viola Marriott Jenkins (Viola), the deceased wife of Joshua; that the real property in question was the separate property of Viola; that Viola predeceased Joshua intestate, and that Joshua, following the death of Viola, "has had possession of the property ... in trust for the plaintiff by virtue of [Glenna's] right to inherit from [Viola]... ." They also alleged in Count III that Joshua held the real property in trust for Glenna "by the agreement with [Joshua] ... that he would deed the property to the plaintiff for the consideration of plaintiff's caring for the property and maintaining the premises during [Joshua's] lifetime."
Hellicksons alleged in Count IV that they filed a claim against Joshua's estate for $2,500 "for expenses and costs and maintenance of" the real property, and that such claim was disallowed by the personal representative, Merrill Jenkins. Based upon such count, they sought judgment against the estate in the amount of $2,500. This claim was asserted as an alternative to Counts I, II and III.
To summarize, the Hellicksons contended that they are entitled to a conveyance of the real property on any of three theories: the alleged oral contract to make a will (Count I), unjust enrichment (Count II) and an express or implied trust (Count III). In the alternative, they seek judgment against Joshua's estate for $2,500 (Count IV).
The action was assigned to the magistrate's division in Bingham County. The respondent (personal representative of Joshua's estate) moved to dismiss Counts I, II and III under I.R.C.P. 12(b)(6), for failure to state a claim upon which relief can be granted and moved to "limit" Count IV. By written memorandum decision, the magistrate denied the motion to "limit" Count IV, but dismissed Counts I, II and III, stating that the court agreed "with the legal authorities and arguments as set forth in [respondents'] initial and supplemental briefs" and that Counts I, II and III "either fail to state a claim upon which relief can be granted or are otherwise barred, as advocated by the [respondent]."[3] The memorandum also recites that the court has carefully "reviewed the pleadings [sic] herein and has taken judicial notice of the proceedings in the Estate of Joshua LaVon Jenkins, Case No. 2411 and the Estate of W. Viola Jenkins, Case No. 2064, both of which are Bingham County cases."
Hellicksons appealed to the district court from the order dismissing Counts I, II and III. The district court ordered that the appeal would "be heard as a question of law alone, without the necessity of a transcript or a trial de novo" and that the appeal would "be decided on the clerk's record, the briefs of the parties and oral argument." The district court then affirmed the magistrate's order dismissing Counts I, II and III and remanded the matter to the magistrate for further proceedings *153 as to Count IV of the complaint. The Hellicksons then brought this appeal from the district court.[4]
On appeal from an order of the district court reviewing a magistrate's findings and conclusions, we examine the record of the trial court independent of, but with due regard for, the district court's intermediate appellate decision. Cole v. Kunzler, 115 Idaho 552, 768 P.2d 815 (Ct. App. 1989). As to questions of law, we will exercise free review. Based upon our review of the magistrate's findings and conclusions, we will affirm or reverse the district court's appellate decision accordingly. Matter of Estate of Bradley, 107 Idaho 860, 693 P.2d 1062 (Ct.App. 1984).
It is clear from the record that the magistrate, by taking judicial notice of the respective probate files relating to the estates of Viola and Joshua, considered matters outside the complaint. If, upon a motion to dismiss filed under I.R.C.P. 12(b)(6), matters outside the pleading being challenged for failure to state a claim upon which relief can be granted are presented to and not excluded by the court, "the motion shall be treated as one for summary judgment and disposed of as provided in I.R.C.P. 56, and all parties shall be given a reasonable opportunity to present all material made pertinent to such a motion by Rule 56." I.R.C.P. 12(b). Indeed, the Idaho Supreme Court has held that when matters outside the pleading, in the form of affidavits, are presented to and considered by the court it is the duty of the court to treat such motion to dismiss as a motion for summary judgment. Boesiger v. DeModena, 88 Idaho 337, 399 P.2d 635 (1965); citing Rush v. G-K Machinery Co., 84 Idaho 10, 367 P.2d 280 (1961).
Here, of course, there is nothing in the record to indicate that the magistrate was presented with any affidavit which he considered in his decision to dismiss Counts I, II and III under Rule 12(b)(6). What he did was to take judicial notice of the probate files above mentioned. The only facts which a court may properly consider on a motion to dismiss for failure to state a claim are those appearing in the complaint, supplemented by such facts as the court may properly judicially notice. Cohen v. United States, 129 F.2d 733 (8th Cir.1942). However, a trial court, in considering a Rule 12(b)(6) motion to dismiss, has no right to hear evidence; and since judicial notice is merely a substitute for the conventional method of taking evidence to establish facts, the court has no right to take judicial notice of anything, with the possible exception of facts of common knowledge which controvert averments of the complaint. See Grand Opera Co. v. Twentieth Century-Fox Film Corp., 235 F.2d 303 (7th Cir.1956); Sears, Roebuck & Co. v. Metropolitan Engravers, Ltd., 245 F.2d 67 (9th Cir.1956); Schwartz v. Commonwealth Land Title Insurance Co., 374 F. Supp. 564 (E.D.Pa. 1974), supp. op. (E.D.Pa.) 384 F. Supp. 302.
There is nothing in the record before us to indicate that the magistrate informed the parties he intended to take judicial notice of the probate files, that the motion to dismiss would be treated as a motion for summary judgment, or that all parties would be given reasonable opportunity to present all material pertinent to such a motion by Rule 56. We hold that his failure to do so constituted error which requires vacating the order dismissing such counts. If a trial court considers factual allegations outside the pleading on a Rule 12(b)(6) motion, it errs if it fails to convert the motion to one for summary judgment. Fonte v. Board of Managers of Continental Towers Condominium, 848 F.2d 24 (2nd Cir.1988); Rose v. Bartle, 871 F.2d 331 (3d Cir.1989). Furthermore, if a court considers matters outside pleadings on a Rule 12(b)(6) motion to dismiss, such motion must be treated as a motion for summary judgment and the proceedings thereafter must comport with the hearing and notice requirements of Rule 56. Underwood v. Hunter, 604 F.2d 367, 369 (5th Cir.1979).
*154 The magistrate's error is compounded by the fact that, although the district judge ordered on appeal that the matter would be heard without a trial de novo, the district court, like the magistrate, considered matters outside Hellicksons' complaint. In its Memorandum Decision affirming the magistrate's order dismissing the three counts, the district court states that it "gleans the following facts admitted in the pleadings or agreed upon during oral argument ..."; following such statement the court went on to set forth numerous facts which were not alleged in Hellicksons' complaint. Nowhere in the district judge's Memorandum Decision does he recognize that when matters outside the pleading are considered by the court on a Rule 12(b)(6) motion, the court has the duty of converting such motion to one for summary judgment. Indeed, the words "summary judgment" do not appear in the district court's decision. It is apparent that the district judge believed he was only presented with a Rule 12(b)(6) issue since he denied Hellicksons' request that the court consider their answers to interrogatories[5] because, inter alia, such answers were "outside the scope of the pleadings." Consistent with that analysis, the court concluded that "Counts I, II and III to plaintiffs' complaint do not state a cause of action upon which relief can be granted and therefore the Court affirms the Magistrate's decision."
However, the district court, upon appeal, had the option of (1) conducting an appellate review of the magistrate's decision just as the Supreme Court would conduct a review of a district court or (2) ordering a trial de novo and beginning the case anew. I.R.C.P. 83(j); Winn v. Winn, 101 Idaho 270, 611 P.2d 1055 (1980). The district court chose the first option and did not order a trial de novo. By so doing, the district court should not have considered matters outside the appellate record presented to it, but should have reviewed the case solely on such record. I.R.C.P. 83(u); cf. Wells v. Wells, 105 Idaho 575, 671 P.2d 488 (Ct.App. 1983) (when the district court, upon appeal, decides to consider facts or matters not in the appellate record, the court should grant a trial de novo, either in that court or by remand to the magistrate).
When the district court decided that it would be appropriate to consider matters not in the appellate record, it either should have ordered a trial de novo on appeal or remanded this matter to the magistrate. We hold that the district court erred in failing to exercise one or the other of such options. Had the district court done so, it would have thereby afforded the parties the opportunity, as required by I.R.C.P. 12(b), to present material pertinent to a summary judgment motion.
It could be argued that Hellicksons have not specifically assigned as error the magistrate's failure to convert the 12(b)(6) motion to one for summary judgment and to allow them a reasonable opportunity to present to the magistrate material pertinent to such motion for summary judgment. However inarticulately stated by Hellicksons, it is apparent to us from a review of their statement of issues on this appeal and their appellate brief that they contend the magistrate did not afford them an opportunity to present material in an effort to demonstrate that a genuine issue of material fact existed such as would have precluded summary judgment. We thus conclude that the issue was adequately raised by Hellicksons.
Even if we had concluded that such issue had not been adequately raised by Hellicksons, there is a further reason for vacating the order dismissing Counts I, II and III. It is difficult for us to determine from the record before us whether the magistrate, in granting the motion to dismiss, and the district judge, in affirming the order of dismissal, applied the Rule 12(b)(6) standard (i.e., whether the complaint stated a claim upon which relief can be granted) or applied the Rule 56 standard (i.e., whether genuine issues of material *155 fact existed). If the 12(b)(6) standard was applied, we are satisfied  in the exercise of free review  that each of the three counts dismissed, untainted by matters outside the complaint, states a claim upon which relief can be granted. Of course, in so holding, we have treated the allegations as true and have considered all intendments and inferences which could reasonably be drawn therefrom in the light most favorable to Hellicksons. Walenta v. Mark Means Co., 87 Idaho 543, 394 P.2d 329 (1964). We also have in mind that the primary object of the law is to obtain a determination of the merits of a claim. Wackerli v. Martindale, 82 Idaho 400, 353 P.2d 782 (1960). It does not appear beyond doubt that Hellicksons could prove no set of facts in support of the claims set forth in the dismissed counts which would entitle them to relief. Wackerli v. Martindale, supra; Williams v. Williams, 82 Idaho 451, 354 P.2d 747 (1960). Having these standards in mind we disagree with the magistrate's conclusion that Counts I, II and III fail to state a claim upon which relief may be granted.
The order affirming the dismissal of said counts is vacated and the matter is remanded to the district court with instructions to further remand to the magistrate division. The district court, upon such further remand is directed to instruct the magistrate either (1) to treat respondent's motion to dismiss as a Rule 12(b)(6) motion and to decide the same based solely upon the allegations of the complaint without consideration of any matters outside the complaint or (2) to convert said motion to a Rule 56, I.R.C.P., proceeding for summary judgment, affording the parties reasonable opportunity to present materials pertinent to a motion for summary judgment and to conduct the proceedings in conformity with the hearing and notice requirements of I.R.C.P. 56.
Costs to appellants, Hellicksons. No fees awarded on appeal.
WALTERS, C.J., and SWANSTROM, J., concur.
NOTES
[1]  It is apparent that Hellicksons contend that they entered into the alleged oral agreement with Joshua Jenkins, not with the named defendant, Merrill Jenkins.
[2]  Although Hellicksons now argue that they did not merely seek, by Count I, to enforce an oral contract to make a will, that argument is without merit; the very language of Count I clearly indicates that the claim set out therein is for specific enforcement of the alleged oral agreement entered into with Joshua.
[3]  Unfortunately, the record before us fails to reflect the arguments contained in the briefs which respondent lodged with the magistrate; likewise, it fails to reflect what other grounds were "advocated" by respondents in bar of the claims in such counts.
[4]  During the pendency of this appeal, the magistrate's order dismissing Counts I, II and III was certified under I.R.C.P. 54(b) as a final judgment.
[5]  We do not address the question of whether such answers to interrogatories should have been considered by the magistrate had the motion to dismiss been properly converted to a Rule 56 motion for summary judgment.
