protected function includeResource(string $identifier, $data, array $parameters): ResourceInterface
    {
        $transformer = $this->mappedTransformerClass($identifier);

        if (method_exists($this, $method = 'include' . ucfirst(camel_case($identifier)))) {
            $resource = $this->resource($this->$method($data, collect($parameters)), $transformer, $identifier);
        } elseif ($data instanceof Model) {
            $resource = $this->includeResourceFromModel($data, $identifier, $transformer);
        } else {
            throw new LogicException('Relation [' . $identifier . '] not found in [' . get_class($this) . '].');
        }

        return $resource;
    }