title: DbContext.SaveChanges() is not updating the database
body: <p>I'm trying to save an entity to the database using entity framework. I have this code which handles the update of the object:</p>
  
  <pre><code>DbSet.Attach(entity);
  </code></pre>
  
  <p>Afterwards I call: </p>
  
  <pre><code>_context.SaveChanges();
  </code></pre>
  
  <p>(I'm using the Unit Of Work pattern with MVC)</p>
  
  <p>The entity I want to add has the state "Modified". Calling the SaveChanges doesn't throw an exception but the return value is 0 and the row in the DB isn't updated. Any idea why this is happening? </p>
  
  <p>P.S. I use the same context to retrieve the entity and then later on to save it.</p>
  
  <p>P.P.S I can post code, I don't know which code would be relevant though because I don't know where the problem originates.</p>