public function getVersionId(EntityInterface $entity)
    {
        $table = TableRegistry::get($this->_config['versionTable']);
        $preexistent = $table->find()
            ->select(['version_id'])
            ->where([
                    'model' => $this->_config['referenceName']
                ] + $this->_extractForeignKey($entity))
            ->order(['id desc'])
            ->limit(1)
            ->enableHydration(false)
            ->toArray();

        return Hash::get($preexistent, '0.version_id', 0);
    }