Moved entity manager in to a part file