Fix #1111 Updating entity results in error 'This identifier already exis...

...ts. It must be unique'