public function onKernelView(GetResponseForControllerResultEvent $event): void
    {
        $presentation = $event->getControllerResult();

        if (!$presentation instanceof PresentationInterface) {
            // Not the presentation instance
            return;
        }

        $data = null;
        $headers = [];

        if ($presentation->getResource()) {
            $acceptableMediaTypes = $event->getRequest()->getAcceptableContentTypes();
            $serializer = $this->serializerResolver->resolveByMediaTypes(
                get_class($presentation->getResource()),
                $acceptableMediaTypes,
                $acceptableMediaType
            );

            $serializationContext = $this->serializationContextCollector->collect();
            $data = $serializer->serialize($presentation->getResource(), $serializationContext);
            $headers = [
                'Content-Type' => $acceptableMediaType,
            ];
        }

        $response = new Response($data, $presentation->getStatusCode());
        $response->headers->add($headers);

        $event->setResponse($response);
    }