Refactor EntityManager creation to reuse one per session

See issue #197. This should close said issue #197.