/**
  * Before the flush we check that the product categories are right.
  *
  * @param PreFlushEventArgs $args The pre flush event arguments.
  */
 public function preFlush(PreFlushEventArgs $args)
 {
     $entityManager = $args->getEntityManager();
     $scheduledInsertions = $entityManager->getUnitOfWork()->getScheduledEntityInsertions();
     $this->categoryIntegrityFixer->fixCategoriesIntegrityByArray($scheduledInsertions);
 }