public function save(AggregateInterface $aggregate): void
    {
        $snapshot = new Snapshot();
        $snapshot->setUuid($aggregate->getUuid());
        $snapshot->setVersion($aggregate->getVersion());
        $snapshot->setAggregateCreated($aggregate->getCreated());
        $snapshot->setAggregateModified($aggregate->getModified());
        $snapshot->setAggregateClass(\get_class($aggregate));
        $snapshot->setHistory($aggregate->getHistory());
        $aggregateData = json_decode(json_encode($aggregate), true);
        $snapshot->setPayload($aggregateData);

        try {
            $this->em->persist($snapshot);
            $this->em->flush();
        } catch (OptimisticLockException $e) {
            $this->messageBus->dispatch(new Message(
                $e->getMessage(),
                $e->getCode(),
                null,
                $aggregate->getUuid(),
                $e
            ));
        } catch (UniqueConstraintViolationException $e) {
            $this->messageBus->dispatch(new Message(
                $e->getMessage(),
                $e->getCode(),
                null,
                $aggregate->getUuid(),
                $e
            ));
        }
    }