-
-               //Protect session fetching
-               try {
-                       //Fetch session
-                       $session = $doctrine->getRepository(Session::class)->findOneById($id);
-
-                       //Fetch session
-                       $session = $doctrine->getRepository(Session::class)->findOneByLocationSlotDate($data['location'], $data['slot'], $data['date']);
-               //Catch no session case
-               } catch (\Doctrine\ORM\NoResultException $e) {
-                       //Create the session
-                       $session = new Session();
-                       $session->setLocation($data['location']);
-                       $session->setDate($data['date']);
-                       $session->setSlot($data['slot']);
-                       $session->setCreated(new \DateTime('now'));
-                       $session->setUpdated(new \DateTime('now'));
-
-                       //Get short location
-                       $short = $data['location']->getShort();
-
-                       //Get slot
-                       $slot = $data['slot']->getTitle();
-
-                       //Set premium
-                       $session->setPremium($premium = false);
-
-                       //Check if slot is afternoon
-                       //XXX: premium is stored only for Afternoon and Evening
-                       if ($slot == 'Afternoon') {
-                               //Compute premium
-                               //XXX: a session is considered premium a day off
-                               $session->setPremium($premium = $this->isPremium($data['date']));
-                       //Check if slot is evening
-                       //XXX: premium is stored only for Afternoon and Evening
-                       } elseif ($slot == 'Evening') {
-                               //Compute premium
-                               //XXX: a session is considered premium the eve of a day off
-                               $session->setPremium($premium = $this->isPremium((clone $data['date'])->add(new \DateInterval('P1D'))));
-                       //Check if slot is after
-                       } elseif ($slot == 'After') {
-                               //Compute premium
-                               //XXX: a session is considered premium the eve of a day off
-                               $premium = $this->isPremium((clone $data['date'])->add(new \DateInterval('P1D')));
-                       }
-
-                       //Set default length at 6h
-                       //XXX: date part will be truncated on save
-                       $session->setLength(new \DateTime('06:00:00'));
-
-                       //Check if admin
-                       if ($this->isGranted('ROLE_ADMIN')) {
-                               //Check if morning
-                               if ($slot == 'Morning') {
-                                       //Set begin at 9h
-                                       $session->setBegin(new \DateTime('09:00:00'));
-
-                                       //Set length at 5h
-                                       $session->setLength(new \DateTime('05:00:00'));
-                               //Check if afternoon
-                               } elseif ($slot == 'Afternoon') {
-                                       //Set begin at 14h
-                                       $session->setBegin(new \DateTime('14:00:00'));
-
-                                       //Set length at 5h
-                                       $session->setLength(new \DateTime('05:00:00'));
-                               //Check if evening
-                               } elseif ($slot == 'Evening') {
-                                       //Set begin at 19h
-                                       $session->setBegin(new \DateTime('19:00:00'));
-
-                                       //Check if next day is premium
-                                       if ($premium) {
-                                               //Set length at 7h
-                                               $session->setLength(new \DateTime('07:00:00'));
-                                       }
-                               //Check if after
-                               } else {
-                                       //Set begin at 1h
-                                       $session->setBegin(new \DateTime('01:00:00'));
-
-                                       //Set length at 4h
-                                       $session->setLength(new \DateTime('04:00:00'));
-
-                                       //Check if next day is premium
-                                       if ($premium) {
-                                               //Set begin at 2h
-                                               $session->setBegin(new \DateTime('02:00:00'));
-
-                                               //Set length at 3h
-                                               $session->setLength(new \DateTime('03:00:00'));
-                                       }
-                               }
-                       //Docks => 14h -> 19h | 19h -> 01/02h
-                       //XXX: remove Garnier from here to switch back to 21h
-                       } elseif (in_array($short, ['Docks', 'Garnier']) && in_array($slot, ['Afternoon', 'Evening', 'After'])) {
-                               //Check if afternoon
-                               if ($slot == 'Afternoon') {
-                                       //Set begin at 14h
-                                       $session->setBegin(new \DateTime('14:00:00'));
-
-                                       //Set length at 5h
-                                       $session->setLength(new \DateTime('05:00:00'));
-                               //Check if evening
-                               } elseif ($slot == 'Evening') {
-                                       //Set begin at 19h
-                                       $session->setBegin(new \DateTime('19:00:00'));
-
-                                       //Check if next day is premium
-                                       if ($premium) {
-                                               //Set length at 7h
-                                               $session->setLength(new \DateTime('07:00:00'));
-                                       }
-                               //Check if after
-                               } else {
-                                       //Set begin at 1h
-                                       $session->setBegin(new \DateTime('01:00:00'));
-
-                                       //Set length at 4h
-                                       $session->setLength(new \DateTime('04:00:00'));
-
-                                       //Check if next day is premium
-                                       if ($premium) {
-                                               //Set begin at 2h
-                                               $session->setBegin(new \DateTime('02:00:00'));
-
-                                               //Set length at 3h
-                                               $session->setLength(new \DateTime('03:00:00'));
-                                       }
-                               }
-                       //Garnier => 21h -> 01/02h
-                       } elseif ($short == 'Garnier' && in_array($slot, ['Evening', 'After'])) {
-                               //Check if evening
-                               if ($slot == 'Evening') {
-                                       //Set begin at 21h
-                                       $session->setBegin(new \DateTime('21:00:00'));
-
-                                       //Set length at 5h
-                                       $session->setLength(new \DateTime('05:00:00'));
-
-                                       //Check if next day is premium
-                                       if ($premium) {
-                                               //Set length at 6h
-                                               $session->setLength(new \DateTime('06:00:00'));
-                                       }
-                               //Check if after
-                               } else {
-                                       //Set begin at 1h
-                                       $session->setBegin(new \DateTime('01:00:00'));
-
-                                       //Set length at 4h
-                                       $session->setLength(new \DateTime('04:00:00'));
-
-                                       //Check if next day is premium
-                                       if ($premium) {
-                                               //Set begin at 2h
-                                               $session->setBegin(new \DateTime('02:00:00'));
-
-                                               //Set length at 3h
-                                               $session->setLength(new \DateTime('03:00:00'));
-                                       }
-                               }
-                       //Trocadero|Tokyo|Swan|Honore|Orsay => 19h -> 01/02h
-                       } elseif (in_array($short, ['Trocadero', 'Tokyo', 'Swan', 'Honore', 'Orsay']) && in_array($slot, ['Evening', 'After'])) {
-                               //Check if evening
-                               if ($slot == 'Evening') {
-                                       //Set begin at 19h
-                                       $session->setBegin(new \DateTime('19:00:00'));
-
-                                       //Check if next day is premium
-                                       if ($premium) {
-                                               //Set length at 7h
-                                               $session->setLength(new \DateTime('07:00:00'));
-                                       }
-                               //Check if after
-                               } else {
-                                       //Set begin at 1h
-                                       $session->setBegin(new \DateTime('01:00:00'));
-
-                                       //Set length at 4h
-                                       $session->setLength(new \DateTime('04:00:00'));
-
-                                       //Check if next day is premium
-                                       if ($premium) {
-                                               //Set begin at 2h
-                                               $session->setBegin(new \DateTime('02:00:00'));
-
-                                               //Set length at 3h
-                                               $session->setLength(new \DateTime('03:00:00'));
-                                       }
-                               }
-                       //La Villette => 14h -> 19h
-                       } elseif ($short == 'Villette' && $slot == 'Afternoon') {
-                               //Set begin at 14h
-                               $session->setBegin(new \DateTime('14:00:00'));
-
-                               //Set length at 5h
-                               $session->setLength(new \DateTime('05:00:00'));
-                       //Place Colette => 14h -> 21h
-                       //TODO: add check here that it's a millegaux account ?
-                       } elseif ($short == 'Colette' && $slot == 'Afternoon') {
-                               //Set begin at 14h
-                               $session->setBegin(new \DateTime('14:00:00'));
-
-                               //Set length at 7h
-                               $session->setLength(new \DateTime('07:00:00'));
-                       //Galerie d'Orléans => 14h -> 18h
-                       } elseif ($short == 'Orleans' && $slot == 'Afternoon') {
-                               //Set begin at 14h
-                               $session->setBegin(new \DateTime('14:00:00'));
-
-                               //Set length at 4h
-                               $session->setLength(new \DateTime('04:00:00'));
-                       //Combination not supported
-                       } else {
-                               //Add error in flash message
-                               $this->addFlash('error', $this->translator->trans('Session on %date% %location% %slot% not yet supported', ['%location%' => $this->translator->trans('at '.$data['location']), '%slot%' => $this->translator->trans('the '.strtolower($data['slot'])), '%date%' => $data['date']->format('Y-m-d')]));
-                       }
-
-                       //Queue session save
-                       $manager->persist($session);
-
-                       //Flush to get the ids
-                       #$manager->flush();
-
-                       $this->addFlash('notice', $this->translator->trans('Session on %date% %location% %slot% created', ['%location%' => $this->translator->trans('at '.$data['location']), '%slot%' => $this->translator->trans('the '.strtolower($data['slot'])), '%date%' => $data['date']->format('Y-m-d')]));
-               }
-
-               //Set user
-               $user = $this->getUser();
-
-               //Replace with requested user for admin
-               if ($this->isGranted('ROLE_ADMIN') && !empty($data['user'])) {
-                       $user = $this->getDoctrine()->getRepository(User::class)->findOneById($data['user']);
-               }
-
-               //Protect application fetching
-               try {
-                       //Retrieve application
-                       $application = $doctrine->getRepository(Application::class)->findOneBySessionUser($session, $user);
-
-                       //Add warning in flash message
-                       $this->addFlash('warning', $this->translator->trans('Application on %date% %location% %slot% already exists', ['%location%' => $this->translator->trans('at '.$data['location']), '%slot%' => $this->translator->trans('the '.strtolower($data['slot'])), '%date%' => $data['date']->format('Y-m-d')]));
-               //Catch no application and session without identifier (not persisted&flushed) cases
-               } catch (\Doctrine\ORM\NoResultException|\Doctrine\ORM\ORMInvalidArgumentException $e) {
-                       //Create the application
-                       $application = new Application();
-                       $application->setSession($session);
-                       $application->setUser($user);
-                       $application->setCreated(new \DateTime('now'));
-                       $application->setUpdated(new \DateTime('now'));
-
-                       //Refresh session updated field
-                       $session->setUpdated(new \DateTime('now'));
-
-                       //Queue session save
-                       $manager->persist($session);
-
-                       //Queue application save
-                       $manager->persist($application);
-
-                       //Flush to get the ids
-                       $manager->flush();
-
-                       //Add notice in flash message
-                       $this->addFlash('notice', $this->translator->trans('Application on %date% %location% %slot% created', ['%location%' => $this->translator->trans('at '.$data['location']), '%slot%' => $this->translator->trans('the '.strtolower($data['slot'])), '%date%' => $data['date']->format('Y-m-d')]));
-               }