Fixed auto-increment when persisting objects