protected function getOxidFromKeyFields($data)
    {
        if (!is_array($this->getKeyFields())) {
            return null;
        }

        $database = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();

        $queryWherePart = [];
        $allKeysExists = true;
        foreach ($this->getKeyFields() as $key) {
            if (array_key_exists($key, $data)) {
                $queryWherePart[] = $key . '=' . $database->quote($data[$key]);
            } else {
                $allKeysExists = false;
            }
        }

        if ($allKeysExists) {
            $query = 'SELECT OXID FROM ' . $this->getTableName() . ' WHERE ' . implode(' AND ', $queryWherePart);

            return $database->getOne($query);
        }

        return null;
    }