title: ObjectStateManager error while adding second data (Entity Framework)
body: <p>When I adding more than one consecutive data an error occurred in SaveChanges() method.</p>
  
  <p>EXCEPTION 
  <strong>The changes to the database were committed successfully, but an error occurred while updating the object context. The ObjectContext might be in an inconsistent state. Inner exception message: AcceptChanges cannot continue because the object's key values conflict with another object in the ObjectStateManager. Make sure that the key values are unique before calling AcceptChanges.</strong></p>
  
  <p>My baseservice</p>
  
  <pre><code>public void Delete(T entity)
      {
          ObjectSet.DeleteObject(entity);
          Context.SaveChanges();
      }
  
      public void Add(T entity)
      {
          ObjectSet.AddObject(entity);
          Context.SaveChanges();
  
      }
  
      public void Attach(T entity)
      {
          ObjectSet.Attach(entity);
          Context.SaveChanges();
      }
  
      public void Update(Expression&lt;Func&lt;T, bool&gt;&gt; where, T entity)
      {
          var ent = First(where);
          ent = entity;
          Context.SaveChanges();
      }
  </code></pre>