public void ProcessRequest(IOrganizationService service, Operation operation,
                                   Func <IOrganizationService, OrganizationRequest, OrganizationRequest> undoFunction = null)
        {
            if (!IsTransactionInEffect())
            {
                throw new Exception("No transaction in effect!");
            }

            try
            {
                // get request from operation
                var request = operation.Request;

                // get the undo request corresponding to the given request
                operation.UndoRequest = undoFunction == null
                                        ? UndoHelper.GenerateReverseRequest(service, request)
                                        : undoFunction(service, request);

                // register this response as the starting point of the latest transaction
                transactionsStack.Peek().StartingPoint ??= operation;
                operationsStack.Push(operation);
            }
            catch (Exception ex)
            {
                throw new Exception("Failed to create undo request for the given request! => " + ex.Message, ex);
            }
        }