public function deleteAction(Collection $collection)
 {
     $this->assertUserRights(UserRole::ROLE_ADMIN);
     if ($this->getUser()->getUserRole($collection->getProject())->getRole() > UserRole::ROLE_ADMIN) {
         throw new AccessDeniedException('You are not allowed to delete this collection');
     }
     $em = $this->getDoctrine()->getManager();
     if (!is_null($collection->getRequests())) {
         foreach ($collection->getRequests() as $oldRequest) {
             $em->remove($oldRequest);
         }
     }
     $em->flush();
     $em->remove($collection);
     $em->flush();
     return $this->redirectToRoute('leankoala_integration_missing_request_homepage');
 }