protected function generateId()
    {
        trigger_error(AutoIdGeneratorTrait::class . ' trait is deprecated', E_USER_DEPRECATED);

        $tryCount = 0;

        do {
            $id = $this->idGenerator->generate();
            $tryCount++;

            if ($tryCount >= $this->getIdGenerateMaxTry()) {
                throw new DataStoreException("Can't generate id.");
            }
        } while ($this->has($id));

        return $id;
    }