Replace object manager with entity manager