public static WorkflowItemEvent ChildWorkflowEvent(this HistoryEvent historyEvent, IEnumerable <HistoryEvent> allEvents) { if (historyEvent.IsChildWorkflowCompletedEvent()) { return(new ChildWorkflowCompletedEvent(historyEvent, allEvents)); } if (historyEvent.IsChildWorkflowFailedEvent()) { return(new ChildWorkflowFailedEvent(historyEvent, allEvents)); } if (historyEvent.IsChildWorkflowCancelledEvent()) { return(new ChildWorkflowCancelledEvent(historyEvent, allEvents)); } if (historyEvent.IsChildWorkflowTimedoutEvent()) { return(new ChildWorkflowTimedoutEvent(historyEvent, allEvents)); } if (historyEvent.IsChildWorkflowTerminatedEvent()) { return(new ChildWorkflowTerminatedEvent(historyEvent, allEvents)); } if (historyEvent.IsChildWorkflowStartedEvent()) { return(new ChildWorkflowStartedEvent(historyEvent, allEvents)); } if (historyEvent.IsChildWorkflowStartFailedEvent()) { return(new ChildWorkflowStartFailedEvent(historyEvent, allEvents)); } if (historyEvent.IsExternalWorkflowCancelRequestedEvent()) { return(new ExternalWorkflowCancellationRequestedEvent(historyEvent)); } if (historyEvent.IsExternalWorkflowCancelRequestFailedEvent()) { return(new ExternalWorkflowCancelRequestFailedEvent(historyEvent)); } return(null); }