public function save(Snapshot $snapshot)
    {
        $table = $this->getTable($snapshot->aggregateType());

        $this->connection->insert(
            $table,
            [
                'aggregate_type' => $snapshot->aggregateType()->toString(),
                'aggregate_id' => $snapshot->aggregateId(),
                'last_version' => $snapshot->lastVersion(),
                'created_at' => $snapshot->createdAt()->format('Y-m-d\TH:i:s.u'),
                'aggregate_root' => serialize($snapshot->aggregateRoot()),
            ],
            [
                'string',
                'string',
                'integer',
                'string',
                'blob',
            ]
        );

        $queryBuilder = $this->connection->createQueryBuilder();
        $table = $this->getTable($snapshot->aggregateType());
        $queryBuilder
            ->delete($table)
            ->where('aggregate_type = :aggregate_type')
            ->andWhere('aggregate_id = :aggregate_id')
            ->andWhere('last_version < :last_version')
            ->setParameter('aggregate_type', $snapshot->aggregateType()->toString())
            ->setParameter('aggregate_id', $snapshot->aggregateId())
            ->setParameter('last_version', $snapshot->lastVersion());

        $queryBuilder->execute();
    }