/**
  * Handle events when modifying dropzone
  * Delete useless events (if manualPlanning) & update/create (if datePlanning)
  * @param  Dropzone $dropzone
  * @return bool
  */
 public function handleEvents(Dropzone $dropzone, User $user)
 {
     $agendaManager = $this->container->get('claroline.manager.agenda_manager');
     $workspace = $dropzone->getResourceNode()->getWorkspace();
     if ($dropzone->getManualPlanning()) {
         if ($dropzone->getEventDrop() != null) {
             $event = $dropzone->getEventDrop();
             $agendaManager->deleteEvent($event);
             $dropzone->setEventDrop(null);
         }
         if ($dropzone->getEventCorrection() != null) {
             $event = $dropzone->getEventCorrection();
             $agendaManager->deleteEvent($event);
             $dropzone->setEventCorrection(null);
         }
     } elseif ($dropzone->getStartAllowDrop() != NULL && $dropzone->getEndAllowDrop() != NULL) {
         if ($dropzone->getEventDrop() != null) {
             // update event
             $eventDrop = $dropzone->getEventDrop();
             $eventDrop->setStart($dropzone->getStartAllowDrop());
             $eventDrop->setEnd($dropzone->getEndAllowDrop());
             $agendaManager->updateEvent($eventDrop);
         } else {
             // create event
             $eventDrop = $this->createAgendaEventDrop($user, $dropzone);
             // event creation + link to workspace
             $agendaManager->addEvent($eventDrop, $workspace);
             // link btween the event and the dropzone
             $dropzone->setEventDrop($eventDrop);
         }
     }
     return $dropzone;
 }