Also clear the entity manager if the entity is unchanged