Changed 'EntityManager' to 'EntityStateManager', which is more appropriate