public static function onPrerenderContent(Event $event)
    {
        $dispatcher = $event->getDispatcher();
        if (null === $application = $dispatcher->getApplication()) {
            return;
        }
        if (null === $token = $application->getBBUserToken()) {
            return;
        }

        $renderer = $event->getEventArgs();
        if (!is_a($renderer, 'BackBee\Renderer\AbstractRenderer')) {
            return;
        }

        $content = $renderer->getObject();
        if (!is_a($content, 'BackBee\ClassContent\AbstractClassContent')) {
            return;
        }

        $em = $application->getEntityManager();
        if (null !== $revision = $em->getRepository('BackBee\ClassContent\Revision')->getDraft($content, $token)) {
            $content->setDraft($revision);
            $application->debug(sprintf(
                'Revision found for `%s` content and `%s` user',
                $content->getUid(),
                $token->getUsername()
            ));
        }

        if (!($content instanceof ContentSet)) {
            foreach ($content->getData() as $key => $subcontent) {
                if (null === $subcontent) {
                    $contenttype = $content->getAcceptedType($key);
                    if (0 === strpos($contenttype, 'BackBee\ClassContent\\')) {
                        if (null === $content->getDraft()) {
                            $revision = $em
                                ->getRepository('BackBee\ClassContent\Revision')
                                ->getDraft($content, $token, true)
                            ;
                            $content->setDraft($revision);
                        }
                        $content->$key = new $contenttype();
                    }
                }
            }
        }
    }