public function preFlush(PreFlushEventArgs $event)
    {
        $em      = $event->getEntityManager();
        $changes = $this->meta_mutation_provider->getFullChangeSet($em);

        foreach ($changes as $updates) {
            if (0 === count($updates)) {
                continue;
            }

            if (false === $this->meta_annotation_provider->isTracked($em, current($updates))) {
                continue;
            }

            foreach ($updates as $entity) {
                if ($entity instanceof Proxy && !$entity->__isInitialized()) {
                    continue;
                }

                $original = $this->meta_mutation_provider->createOriginalEntity($em, $entity);

                $mutated_fields = $this->meta_mutation_provider->getMutatedFields($em, $entity, $original);

                if (null === $original || !empty($mutated_fields)) {
                    $this->logger->debug(
                        'Going to notify a change (preFlush) to {entity_class}, which has {mutated_fields}',
                        [
                            'entity_class' => get_class($entity),
                            'mutated_fields' => $mutated_fields
                        ]
                    );
                    $em->getEventManager()->dispatchEvent(
                        Events::ENTITY_CHANGED,
                        new EntityChangedEvent($em, $entity, $original, $mutated_fields)
                    );
                }
            }
        }
    }