Fixed a bug raising ConcurrentUpdate when saving a new object with preset primary key

Checkout just the commit with tests first to see the problem. The second commit contains a fix.