/**
  * @param SubscriptionCancelCommand $message
  *
  * @throws \Baboon\SubscriptionBundle\Exception\PackageNotFoundException
  * @throws \Baboon\SubscriptionBundle\Exception\SubscriptionManageException
  */
 public function cancelSubscription(SubscriptionCancelCommand $message)
 {
     if (null === ($package = $this->packageManager->findInitial())) {
         throw new PackageNotFoundException('Initial package');
     }
     $currentPackage = $this->subscriptionProvider->getPackage();
     if (null !== $currentPackage && $currentPackage->isInitial()) {
         throw new SubscriptionManageException(sprintf('Current package "%s" not cancelable', $currentPackage));
     }
     if (null !== ($subscription = $this->subscriptionProvider->getSubscription())) {
         $subscription->select($package);
         $this->subscriptionManager->updateSubscription($subscription);
         $this->eventRecorder->record(new SubscriptionCanceledEvent($subscription));
     }
 }
 protected function updateItem($item, $andFlush = true)
 {
     return $this->manager->updateSubscription($item, $andFlush);
 }