public function getEntityManager()
    {
        if (isset($this->entityManager) && is_object($this->entityManager)) {
            // 5.8 ->
            return $this->entityManager;
        }
        $pkgID = $this->c->getPackageID();
        if ($pkgID > 0) {
            return Package::getByID($pkgID)->getEntityManager();
        } else {
            return ORM::entityManager('app');
        }
    }