private function buildConfig(Request $request)
    {
        $config = array(
            'mode' => $request->query->get('mode', 'browse'),
        );
        if (null !== $types = $request->query->get('types', array())) {
            // TODO validate types
            $config['types'] = $types;
        }
        return $config;
    }