static bool PopNextWorkflow(WorkflowState state, bool pauseExecution = false) { var success = false; switch (state) { case WorkflowState.ToDo: BaseWorkflowService.ProcessCommenceWorkAction(state); success = true; break; case WorkflowState.Doing: if (pauseExecution) { BaseWorkflowService.ProcessPauseWorkAction(state); } else { BaseWorkflowService.ProcessEndWorkAction(state); } success = true; break; case WorkflowState.Waiting: BaseWorkflowService.ProcessCommenceWorkAction(state); success = true; break; case WorkflowState.Done: break; } return(success); }