title: Getting duplicate Cache.Inserted records when trying to create new row
body: <p>I am trying to generate a production order and insert one detail line. When creating the detail line, everything is going well until I try to call the Persist or Update methods. When I do that, the line I'm trying to insert is duplicated and I receive the following error: Another process has added the 'AMProdMatl' record. Your changes will be lost.</p>
  
  <p>Here is a brief example of my code:</p>
  
  <pre><code>        AMProdMatl fabric = new AMProdMatl();
          fabric = graphDetail.ProdMatlRecords.Insert(fabric);
          //Set values
          AMProdMatlExt fabricExt = fabric.GetExtension&lt;AMProdMatlExt&gt;();
          //Set values
          fabric = graphDetail.ProdMatlRecords.Update(fabric);
          graphDetail.Persist();
  </code></pre>
  
  <p>Why is it trying to insert a second duplicate record and how can that be fixed?</p>