title: Breeze creates duplicate entity in local cache after saving to server
body: <p>I'm having the same problem as described in <a href="https://stackoverflow.com/questions/22248585/new-breeze-1-4-9-duplicate-entity-possible-bug">New Breeze 1.4.9 - Duplicate entity - possible bug?</a>, however that problem was reported as being caused by a bug since fixed. I am using v1.4.11.</p>
  
  <p>I'm finding that when I save a new Breeze entity to the server it reacts to the successful response from the server by creating a new, duplicate entity, instead of updating the existing one. I am running the following test code line-by-line in a browser console, from a state of having no entities in Breeze's cache.</p>
  
  <pre><code>EntityManager.createEntity("CustomGroup", properties);
  EntityManager.getChanges(); =&gt;
      0:
          Id="b0cb3194-35af-4d23-9e77-d192c907b566"
          EntityState=Added
  </code></pre>
  
  <p>So far, so good. As expected there is a single entity in the pending changes array.</p>
  
  <pre><code>EntityManager.saveChanges(); =&gt;
      KeyMappings:
          0:
              TempValue="b0cb3194-35af-4d23-9e77-d192c907b566"
              RealValue="f056f519-9f11-4375-a0dd-5272a11b9b46"
  </code></pre>
  
  <p>After executing saveChanges(), the server returns a KeyMapping object with the temp and real key values. At this point, listing all entities in the cache reveals an unexpected result:</p>
  
  <pre><code>EntityManager.getEntities(); =&gt;
      0:
          Id="f056f519-9f11-4375-a0dd-5272a11b9b46"
          EntityState=Added
      1:
          Id="b0cb3194-35af-4d23-9e77-d192c907b566"
          EntityState=Unchanged
  </code></pre>
  
  <p>So, while Breeze has changed the state of the original object to "Unchanged" in response to being saved to the server, it has not updated it with the new key, and has instead created a duplicate entity using the new key, which it thinks it still needs to save. </p>
  
  <p>A 2nd call to saveChanges() sends a new request to the server, which responds with a KeyMapping object that has identical TempValue and RealValue, and at this point Breeze decides there are no more changes, although the rogue entity remains in the cache of course.</p>