This looks wrong to me. It always return for the first entity manager even when it is not the manager related to the entity.