protected function serializeWith($instance, string $name)
    {
        $serializer = $this->getVersionedResourceClassName('Serializers', $name);

        if (\class_exists($serializer)) {
            return \call_user_func(app($serializer), $instance);
        }

        if ($instance instanceof Fluent) {
            return $instance->getAttributes();
        } elseif ($instance instanceof Collection) {
            return $instance->all();
        } elseif ($instance instanceof Arrayable) {
            return $instance->toArray();
        }

        return $instance;
    }