public function listContentTypes(Request $request)
    {
        if ($this->getMediaType($request) === 'application/vnd.ez.api.contenttypelist') {
            $return = new Values\ContentTypeList(array(), $request->getPathInfo());
        } else {
            $return = new Values\ContentTypeInfoList(array(), $request->getPathInfo());
        }

        if ($request->query->has('identifier')) {
            $return->contentTypes = array($this->loadContentTypeByIdentifier($request));

            return $return;
        }

        if ($request->query->has('remoteId')) {
            $return->contentTypes = array(
                $this->loadContentTypeByRemoteId($request),
            );

            return $return;
        }

        $limit = null;
        if ($request->query->has('limit')) {
            $limit = (int)$request->query->get('limit', null);
            if ($limit <= 0) {
                throw new BadRequestException('wrong value for limit parameter');
            }
        }
        $contentTypes = $this->getContentTypeList();
        $sort = $request->query->get('sort');
        if ($request->query->has('orderby')) {
            $orderby = $request->query->get('orderby');
            $this->sortContentTypeList($contentTypes, $orderby, $sort);
        }
        $offset = $request->query->get('offset', 0);
        $return->contentTypes = array_slice($contentTypes, $offset, $limit);

        return $return;
    }