public function commit(ConnectionInterface $connection)
    {
        // We decrement the transaction level and prevent events to be dispatched
        // while comitting nested transactions, so no transient state is saved.
        // Only dispatch events right after the outer transaction commits.
        $this->transactionLevel--;
        if (! $this->isPrepared($connection) || $this->transactionLevel > 0) {
            return;
        }

        $this->dispatchPendingEvents($connection);
    }