private void DisposeTransactionIfNotAlreadyDisposed(bool txDisposed) { try { if (txDisposed == false && tx != null) { if (beforeTransactionRollback != null) { beforeTransactionRollback(currentMessageInformation); } logger.Warn("Disposing transaction in error mode"); tx.Dispose(); } } catch (Exception e) { logger.Warn("Failed to dispose of transaction in error mode.", e); } }