private function getContent(Request $request, $id)
    {
        $properties = array_filter(explode(',', $request->get('fields', '')));
        $excludeGhosts = $this->getBooleanRequestParameter($request, 'exclude-ghosts', false, false);
        $excludeShadows = $this->getBooleanRequestParameter($request, 'exclude-shadows', false, false);
        $webspaceNodes = $this->getRequestParameter($request, 'webspace-nodes');
        $locale = $this->getRequestParameter($request, 'language', true);
        $webspaceKey = $this->getRequestParameter($request, 'webspace');

        $user = $this->getUser();

        $mapping = MappingBuilder::create()
            ->setHydrateGhost(!$excludeGhosts)
            ->setHydrateShadow(!$excludeShadows)
            ->setResolveConcreteLocales(true)
            ->addProperties($properties)
            ->getMapping();

        $data = $this->get('sulu_page.content_repository')->find($id, $locale, $webspaceKey, $mapping, $user);
        $view = $this->view($data);

        return $this->handleView($view);
    }