make entitymanager a global instead of passing it around