protected function validateHasOne(
        RelationshipInterface $relationship,
        $record = null,
        $key = null,
        ResourceObjectInterface $resource = null
    ) {
        if (!$relationship->isHasOne()) {
            $this->addError($this->errorFactory->relationshipHasOneExpected($key));
            return false;
        }

        $identifier = $relationship->getData();

        if (!$identifier) {
            return true;
        }

        /** Validate the identifier */
        if (!$this->validateIdentifier($identifier, $key)) {
            return false;
        }

        /** If an identifier has been provided, the resource it references must exist. */
        if (!$this->validateExists($identifier, $key)) {
            return false;
        }

        /** If an identifier has been provided, is it acceptable for the relationship? */
        if (!$this->validateAcceptable($identifier, $record, $key, $resource)) {
            return false;
        }

        return true;
    }