function editHumans($slug, Request $request, Application $app)
 {
     if (!$this->build($slug, $request, $app)) {
         $app->abort(404, "Event does not exist.");
     }
     $humanRepo = new HumanRepository();
     if ('POST' == $request->getMethod() && $request->request->get('CSFRToken') == $app['websession']->getCSFRToken()) {
         if ($request->request->get('addHuman')) {
             $data = $request->request->get('addHuman');
             if (!is_array($data)) {
                 $data = array($data);
             }
             foreach ($data as $slug) {
                 $human = $humanRepo->loadBySlug($app['currentSite'], $slug);
                 if ($human) {
                     $humanRepo->addHumanToEvent($human, $this->parameters['event'], $app['currentUser']);
                 }
             }
         } elseif ($request->request->get('removeHuman')) {
             $human = $humanRepo->loadBySlug($app['currentSite'], $request->request->get('removeHuman'));
             if ($human) {
                 $humanRepo->removeHumanFromEvent($human, $this->parameters['event'], $app['currentUser']);
             }
         }
         if ($request->request->get("returnTo") == 'event') {
             return $app->redirect("/event/" . $this->parameters['event']->getSlugforURL());
         }
     }
     $trb = new HumanRepositoryBuilder();
     $trb->setSite($app['currentSite']);
     $trb->setIncludeDeleted(false);
     $trb->setHumansForEvent($this->parameters['event']);
     $this->parameters['humans'] = $trb->fetchAll();
     $this->parameters['filterLimitToArea'] = $request->query->get('limitToArea') != 'no';
     $this->parameters['filterFreeTextSearch'] = $request->query->get('freeTextSearch');
     $trb = new HumanRepositoryBuilder();
     $trb->setSite($app['currentSite']);
     $trb->setIncludeDeleted(false);
     $trb->setHumansNotForEvent($this->parameters['event']);
     if ($this->parameters['area'] && $this->parameters['filterLimitToArea']) {
         $trb->setArea($this->parameters['area']);
     }
     if ($this->parameters['filterFreeTextSearch']) {
         $trb->setFreeTextsearch($this->parameters['filterFreeTextSearch']);
     }
     $trb->setLimit(200);
     $this->parameters['humansToAdd'] = $trb->fetchAll();
     return $app['twig']->render('site/event/edit.humans.html.twig', $this->parameters);
 }
 protected function build($slug, Request $request, Application $app)
 {
     $this->parameters = array('currentUserWatchesGroup' => false);
     if (strpos($slug, "-")) {
         $slug = array_shift(explode("-", $slug, 2));
     }
     $tr = new HumanRepository();
     $this->parameters['human'] = $tr->loadBySlug($app['currentSite'], $slug);
     if (!$this->parameters['human']) {
         return false;
     }
     return true;
 }