/**
  * @param GenericEvent $event
  */
 public function updateChannel(GenericEvent $event)
 {
     $channel = $event->getSubject();
     if (!$channel instanceof ChannelInterface) {
         return;
     }
     $oldLocales = $this->repository->getDeletedLocalesForChannel($channel);
     $newLocales = $channel->getLocales();
     $updatedLocales = [];
     foreach ($oldLocales as $locale) {
         $locale->removeChannel($channel);
         $updatedLocales[] = $locale;
         $this->completeness->scheduleForChannelAndLocale($channel, $locale);
     }
     foreach ($newLocales as $locale) {
         if (!$locale->hasChannel($channel)) {
             $locale->addChannel($channel);
             $updatedLocales[] = $locale;
         }
     }
     if (!empty($updatedLocales)) {
         $this->saver->saveAll($updatedLocales);
     }
 }
 /**
  * Schedule recalculation of completenesses for all product
  * of a family
  *
  * @param FamilyInterface $family
  */
 public function scheduleForFamily(FamilyInterface $family)
 {
     if ($family->getId()) {
         $this->generator->scheduleForFamily($family);
     }
 }