private function collectEventsFromDocument(LifecycleEventArgs $event)
    {
        $entity = $event->getEntity();

        if ($entity instanceof UserAggregateRoot) {
            foreach ($entity->events() as $event) {
                $this->collectedEvents[] = $event;
            }

            $entity->eraseEvents();
        }
    }