/**
  * "Success" form handler
  *
  * @param CalendarEvent   $entity
  * @param ArrayCollection $originalChildren
  * @param boolean         $notify
  */
 protected function onSuccess(CalendarEvent $entity, ArrayCollection $originalChildren, $notify)
 {
     $new = $entity->getId() ? false : true;
     $this->manager->persist($entity);
     $this->manager->flush();
     if ($new) {
         $this->emailSendProcessor->sendInviteNotification($entity);
     } else {
         $this->emailSendProcessor->sendUpdateParentEventNotification($entity, $originalChildren, $notify);
     }
 }
 /**
  * {@inheritdoc}
  */
 public function handleDelete($id, ApiEntityManager $manager)
 {
     $entity = $manager->find($id);
     if (!$entity) {
         throw new EntityNotFoundException();
     }
     $em = $manager->getObjectManager();
     $this->checkPermissions($entity, $em);
     $this->deleteEntity($entity, $em);
     $em->flush();
     $this->emailSendProcessor->sendDeleteEventNotification($entity);
 }