public static async Task <OperationResult <T> > RunWithTransactionAsync <T>(this ITransactionScopeProvider provider, Func <ITransactionScopeDataAccessor, Task <OperationResult <T> > > callback)
        {
            ITransactionScopeDataAccessor accessor = null;

            try {
                accessor = provider.GetTransactionScopeDataAccessor();

                var operation = await callback(accessor);

                if (operation.WasSuccessful)
                {
                    var commitTransaction = accessor.CommitTransaction();
                    if (commitTransaction.WasSuccessful == false)
                    {
                        return(new OperationResult <T>(commitTransaction.Exceptions));
                    }
                }
                else
                {
                    var rollbackTransaction = accessor.RollbackTransaction();
                    if (rollbackTransaction.WasSuccessful == false)
                    {
                        return(new OperationResult <T>(false, operation.Result, operation.Exceptions.Concat(rollbackTransaction.Exceptions)));
                    }
                }

                return(operation);
            }
            catch (Exception ex) {
                var rollBack =
                    accessor?.RollbackTransaction();

                var exceptions = new List <Exception>();
                exceptions.Add(ex);

                if (rollBack != null)
                {
                    exceptions.AddRange(rollBack.Exceptions);
                }

                return(new OperationResult <T>(exceptions));
            }
        }
        public OperationResult CommitTransaction()
        {
            var operation = _component.CommitTransaction();

            _logger.Log("\r\n");
            if (operation.WasSuccessful)
            {
                _logger.Log("Transaction successfully committed.");
            }
            else
            {
                _logger.Log("Transaction committal failed.");
            }
            _logger.Log("\r\n");
            _logger.Log($"TX - Transaction reference number {_scopeGUID} destroyed.");
            _logger.Log("\r\n");
            _logger.Log("\r\n");
            _logger.Log(new string('*', 120));
            _logger.Log("\r\n");
            return(operation);
        }