public static function getListByPackage($pkg)
    {
        $app = Application::getFacadeApplication();
        $db = $app->make(Connection::class);

        $kina = ['-1'];
        $rs = $db->executeQuery('select pkCategoryID from PermissionKeyCategories where pkgID = ?', [$pkg->getPackageID()]);
        while (($pkCategoryID = $rs->fetchColumn()) !== false) {
            $kina[] = $pkCategoryID;
        }
        $kinstr = implode(',', $kina);

        $categories = [];
        /* @var \Concrete\Core\Permission\Category[] $categories */
        $list = [];
        $r = $db->executeQuery('select pkID, pkCategoryID from PermissionKeys where (pkgID = ? or pkCategoryID in (' . $kinstr . ')) order by pkID asc', [$pkg->getPackageID()]);
        while (($row = $r->fetch(PDO::FETCH_ASSOC)) !== false) {
            if (!isset($categories[$row['pkCategoryID']])) {
                $categories[$row['pkCategoryID']] = PermissionKeyCategory::getByID($row['pkCategoryID']);
            }
            $pkc = $categories[$row['pkCategoryID']];
            $pk = $pkc->getPermissionKeyByID($row['pkID']);
            $list[] = $pk;
        }

        return $list;
    }