Remove duplicate code in WorkflowExecution