public function getNext($ident)
    {
        $database = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();

        /** Current counter retrieval needs to be encapsulated in transaction */
        $database->startTransaction();
        try {
            /** Block row for reading until the counter is updated */
            $query = "SELECT `oxcount` FROM `oxcounters` WHERE `oxident` = ? FOR UPDATE";
            $currentCounter = (int) $database->getOne($query, [$ident]);
            $nextCounter = $currentCounter + 1;

            /** Insert or increment the the counter */
            $query = "INSERT INTO `oxcounters` (`oxident`, `oxcount`) VALUES (?, 1) ON DUPLICATE KEY UPDATE `oxcount` = `oxcount` + 1";
            $database->execute($query, [$ident]);

            $database->commitTransaction();
        } catch (Exception $exception) {
            $database->rollbackTransaction();

            throw $exception;
        }

        return $nextCounter;
    }