protected function prepareTransaction($connection)
    {
        $connectionId = $connection->getName();
        $this->transactionLevel = $this->transactionLevel > 0 ? $this->transactionLevel + 1 : 1;

        // Now we prepare a new array level for this transaction in the current
        // transaction level. It allows nested transactions to rollback and
        // their events discarded without affecting previous transactions.
        $this->pendingEvents[$connectionId][$this->transactionLevel][] = [];
    }