public void SubmitChanges(CreditNote document, BasicConfig config)
        {
            int sequence = 0;
            var envelope = new CommandEnvelope();
            envelope.Initialize(document);
            List<DocumentCommand> commandsToExecute = document.GetDocumentCommandsToExecute();

            CreateCommand createCommand= commandsToExecute.OfType<CreateCommand>().FirstOrDefault();
            if (createCommand != null)
                envelope.CommandsList.Add(new CommandEnvelopeItem(++sequence, createCommand));
               // _commandRouter.RouteDocumentCommand(createCommand);
            List<AfterCreateCommand> lineItemCommands = commandsToExecute.OfType<AfterCreateCommand>().ToList();
            foreach (var item in lineItemCommands)
            {
                envelope.CommandsList.Add(new CommandEnvelopeItem(++sequence, item));
                //_commandRouter.RouteDocumentCommand(item);
                
            }

            ConfirmCreditNoteCommand confirmCreditNoteCommand = commandsToExecute.OfType<ConfirmCreditNoteCommand>().FirstOrDefault();
            if (confirmCreditNoteCommand != null)
                envelope.CommandsList.Add(new CommandEnvelopeItem(++sequence, confirmCreditNoteCommand));

               // _commandRouter.RouteDocumentCommand(confirmCreditNoteCommand);
            _commandEnvelopeRouter.RouteCommandEnvelope(envelope);
           
        }