Fixed deprecated call to EntityManager