protected function getRelationshipHydrator($book): array
    {
        return [
            "authors" => function (array $book, ToManyRelationship $authors, $data, $relationshipName) {
                if ($authors->isEmpty()) {
                    $book["authors"] = [];
                } else {
                    $book["authors"] = BookRepository::getAuthors($authors->getResourceIdentifierIds());
                }

                return $book;
            },
            "publisher" => function (array &$book, ToOneRelationship $publisher, $data, $relationshipName) {
                if ($publisher->isEmpty()) {
                    $book["publisher"] = null;
                } else {
                    $book["publisher"] = BookRepository::getPublisher((int) $publisher->getResourceIdentifier()->getId());
                }
            }
        ];
    }