Improve deletion, replacement and adding of entities