Reworked to using a shared entity manager. Added tests. Removed coverage from git