private function buildKey($userObject)
    {
        $key = $this->classMetadata->getPropertyValue($userObject, ClassMetadata::API_KEY_PROPERTY);

        if (empty($key)) {
            $this->classMetadata->modifyProperty(
                $userObject,
                $this->keyFactory->getKey(),
                ClassMetadata::API_KEY_PROPERTY
            );
        }
    }