public function acknowledgeAction(Request $request, Incident $incident)
 {
     $this->assertUserRights(UserRole::ROLE_COLLABORATOR, $incident->getEventIdentifier()->getProject());
     if ($incident->isClosed()) {
         return new JsonResponse(['status' => 'failure', 'message' => "Incident already closed."]);
     }
     if ($incident->getAcknowledgedBy() == $this->getUser()) {
         $incident->setAcknowledgedBy();
         $action = 'unack';
         $message = 'You have successfully be unasigned.';
     } else {
         $incident->setAcknowledgedBy($this->getUser());
         $message = 'You have been assigned to this incident.';
         $action = "ack";
     }
     $em = $this->getDoctrine()->getManager();
     $project = $incident->getEventIdentifier()->getProject();
     $project->setLastStatusChange(new \DateTime('now'));
     $em->persist($incident);
     $em->persist($project);
     $em->flush();
     if ($action == 'ack') {
         $this->get('event_dispatcher')->dispatch('koalamon.incident.acknowledge', new IncidentEvent($incident));
     }
     return new JsonResponse(['status' => 'success', 'message' => $message, 'action' => $action, 'id' => $incident->getId(), 'email' => $this->getUser()->getEmail()]);
 }