protected function resolveNestedRelations($data, $request)
    {
        foreach ($data as $key => $value) {
            if (is_array($value)) {
                $data[$key] = $this->resolveNestedRelations($value, $request);
            }
            elseif ($value instanceof static) {
                $data[$key] = $value->resolve($request);
            }
        }

        return $this->filter($data);
    }