public static WorkflowItemEvent CreateActivityEventFor(this HistoryEvent historyEvent, IEnumerable <HistoryEvent> allHistoryEvents) { if (historyEvent.IsActivityCompletedEvent()) { return(new ActivityCompletedEvent(historyEvent, allHistoryEvents)); } if (historyEvent.IsActivityFailedEvent()) { return(new ActivityFailedEvent(historyEvent, allHistoryEvents)); } if (historyEvent.IsActivityTimedoutEvent()) { return(new ActivityTimedoutEvent(historyEvent, allHistoryEvents)); } if (historyEvent.IsActivityCancelledEvent()) { return(new ActivityCancelledEvent(historyEvent, allHistoryEvents)); } if (historyEvent.IsActivityCancelRequestedEvent()) { return(new ActivityCancelRequestedEvent(historyEvent)); } if (historyEvent.IsActivityCancellationFailedEvent()) { return(new ActivityCancellationFailedEvent(historyEvent)); } if (historyEvent.IsActivityStartedEvent()) { return(new ActivityStartedEvent(historyEvent, allHistoryEvents)); } if (historyEvent.IsActivityScheduledEvent()) { return(new ActivityScheduledEvent(historyEvent, allHistoryEvents)); } if (historyEvent.IsActivitySchedulingFailedEvent()) { return(new ActivitySchedulingFailedEvent(historyEvent)); } return(null); }