protected function validatePagination($pagination): void
    {
        if (! is_array($pagination)) {
            throw new InvalidQueryException('Attribute "page" of query must be an array.');
        }

        $unexpected = array_diff(array_keys($pagination), ['offset', 'limit']);

        if (empty($unexpected)) {
            return;
        }

        throw new InvalidQueryException(sprintf(
            'Unexpected member(s) of "page" attribute: "%s". Only "offset" and "limit" are acceptable.',
            implode('", "', $unexpected)
        ));
    }