/// <summary>
        /// Handles a Dispose signal from a transaction.
        /// </summary>
        /// <param name="transaction"></param>
        void OnTransactionDisposing(UnitOfWorkTransaction transaction)
        {
            _logger.LogInformation("UnitOfWorkTransaction {0} signalled a disposed. Unregistering transaction from TransactionManager {1}",
                                   transaction.TransactionId, _transactionManagerId);

            transaction.TransactionDisposing -= OnTransactionDisposing;
            var node = _transactions.Find(transaction);

            if (node != null)
            {
                _transactions.Remove(node);
            }
        }
        /// <summary>
        /// Enlists a <see cref="UnitOfWorkScope"/> instance with the transaction manager,
        /// with the specified transaction mode.
        /// </summary>
        /// <param name="scope">The <see cref="IUnitOfWorkScope"/> to register.</param>
        /// <param name="mode">A <see cref="TransactionMode"/> enum specifying the transaciton
        /// mode of the unit of work.</param>
        public void EnlistScope(IUnitOfWorkScope scope, TransactionMode mode)
        {
            _logger.LogInformation("Enlisting scope {0} with transaction manager {1} with transaction mode {2} called from: " + new StackFrame(1).GetMethod().Name,
                                   scope.ScopeId,
                                   _transactionManagerId,
                                   mode);

            if (_transactions.Count == 0 ||
                mode == TransactionMode.New ||
                mode == TransactionMode.Supress)
            {
                _logger.LogDebug("Enlisting scope {0} with mode {1} requires a new TransactionScope to be created.", scope.ScopeId, mode);
                var txScope     = TransactionScopeHelper.CreateScope(_logger, UnitOfWorkSettings.DefaultIsolation, mode);
                var unitOfWork  = _unitOfWorkFactory.Create();
                var transaction = new UnitOfWorkTransaction(_logger, unitOfWork, txScope);
                transaction.TransactionDisposing += OnTransactionDisposing;
                transaction.EnlistScope(scope);
                _transactions.AddFirst(transaction);
                return;
            }
            CurrentTransaction.EnlistScope(scope);
        }