protected function generateId(): int
    {
        if ($this->getId() !== null) {
            return $this->getId();
        }

        $maxIdLength = \mb_strlen((string) PHP_INT_MAX) - 1;

        // try generate unique id for file
        $id = mb_substr(crc32($this->getModelId()), $maxIdLength - self::ID_PATH_HASH_LENGTH)
            . mb_substr(crc32($this->getActualPath()), self::ID_PATH_HASH_LENGTH);

        return (int) $id;
    }