Fixed persisting entities with custom id