title: KnockoutJS Maximum Call stack size exceeded
body: <p>I have this code:</p>
  
  <pre><code>self.EditItemPopup = function (something) {
      var temp = ko.mapping.toJS(something);
      //self.ItemToEdit = ko.mapping.fromJS(temp, EditItem, self.ItemToEdit);
      ko.mapping.fromJS(temp, EditItem,self.ItemToEdit);
      self.FindMatchingCategory(something.CategoryID());
      $("#editItemPopup").dialog("open");
  };
  
  self.FindMatchingCategory = function (categoryID) {
      ko.utils.arrayForEach(self.ViewModel().Categories(), function (categoryToFind) {
          if (categoryToFind.CategoryID() == categoryID) {
              self.ItemEditCategory(categoryToFind);
          }
      });
  };
  </code></pre>
  
  <p>When self.EditItemPopup is called once everything works fine, but when it is called a second time I get this error:
  Uncaught RangeError: Maximum call stack size exceeded </p>
  
  <p>Could someone tell me where the problem is?</p>
  
  <p>Thanks!</p>
  
  <p>EDIT:</p>
  
  <p>EditItem mapping:</p>
  
  <pre><code>var EditItem = {
      ItemName: ko.validatedObservable().extend({
          required: {
              message: "Please enter an item name.",
              insertMessages: false
          }
      }),
      ItemCost: ko.validatedObservable().extend({
          required: {
              message: "Please enter a valid price.",
              insertMessages: false
          }
      }),
      CategoryID: ko.observable()
  };
  </code></pre>