public void SetPaidStatus(BillDemandPaidApiCommandArgument arg) { AuthenticationService.Authenticate(arg.SecurityToken); if (!AuthenticationService.IsAuthenticated()) { return; } if (!AuthorizationService.IsAllowedToExecuteCommand(arg.InstanceId, WorkflowCommandType.SetPaidStatus)) { return; } FireCommandWithWaiting(arg, delegate(BillDemandPaidApiCommandArgument arg1) { using (var sync = GetWorkflowSync(arg1)) { WorkflowInitService.RaiseSetPaidStatus(arg1.InstanceId, arg1.PaymentDate, arg1.DocumentNumber); sync.WaitHandle.WaitOne(4000); } }); }