/**
  * @param Resource $resource
  * @param Category $category
  * @param Area $area
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function listAction(Resource $resource, Category $category, Area $area = null)
 {
     $em = $this->getDoctrine()->getManager();
     /** @var \Bigfish\Bundle\PagekitBundle\Entity\Repository\AreaRepository $areas */
     $areas = $em->getRepository('BigfishPagekitBundle:Area')->findByTemplate($resource->getTemplate(), $category);
     $grids = array();
     foreach ($areas as $area) {
         /** @var \Bigfish\Bundle\PagekitBundle\Entity\Repository\InstanceRepository $entities */
         $entities = $em->getRepository('BigfishPagekitBundle:Instance')->findInstances($area, $resource);
         $grid = $this->container->get('bigfish.grid.factory')->createGrid($this->container->get('bigfish.pagekit.grid.area_list'), $entities, array('title' => $area->getTitle(), 'category' => $category, 'area' => $area, 'resource' => $resource, 'maxWidgets' => $area->getMaxWidgets(), 'currentWidgets' => count($entities)))->createView();
         $grids[] = $grid;
     }
     return $this->render('BigfishPagekitBundle:Area:list.html.twig', array('grids' => $grids));
 }