protected function getArrayAndKeyName(string $fieldName, string $key): array
    {
        if (!in_array($key, ['filters', 'sorts'], true)) {
            throw new InvalidArgumentException('Key must be one of [filters, sorts]');
        }
        if (str_contains($fieldName, '.')) {
            $path         = explode('.', $fieldName);
            $name         = array_pop($path);
            $relationPath = implode('.', $path);
            $array        = array_get($this->relations, "$relationPath.$key", []);
        } else {
            $name  = $fieldName;
            $array = ($key === 'filters') ? $this->filters : $this->sorts;
        }
        return [$name, $array];
    }