public IEnumerable <HistoryEvent> ActivityCancelledGraph(Identity activityIdentity, string identity, string detail) { var historyEvents = new List <HistoryEvent>(); var eventIds = EventIds.CancelledIds(ref _currentEventId); historyEvents.Add(new HistoryEvent() { EventType = EventType.ActivityTaskCanceled, EventId = eventIds.EventId(EventIds.Cancelled), ActivityTaskCanceledEventAttributes = new ActivityTaskCanceledEventAttributes() { Details = detail, LatestCancelRequestedEventId = eventIds.EventId(EventIds.CancelRequested), ScheduledEventId = eventIds.EventId(EventIds.Scheduled), StartedEventId = eventIds.EventId(EventIds.Started) } }); historyEvents.Add(new HistoryEvent() { EventType = EventType.ActivityTaskCancelRequested, EventId = eventIds.EventId(EventIds.CancelRequested), ActivityTaskCancelRequestedEventAttributes = new ActivityTaskCancelRequestedEventAttributes() { ActivityId = activityIdentity.Id, } }); historyEvents.Add(new HistoryEvent() { EventType = EventType.ActivityTaskStarted, EventId = eventIds.EventId(EventIds.Started), ActivityTaskStartedEventAttributes = new ActivityTaskStartedEventAttributes() { Identity = identity, ScheduledEventId = eventIds.EventId(EventIds.Scheduled) } }); historyEvents.Add(new HistoryEvent() { EventType = EventType.ActivityTaskScheduled, EventId = eventIds.EventId(EventIds.Scheduled), ActivityTaskScheduledEventAttributes = new ActivityTaskScheduledEventAttributes() { ActivityType = new ActivityType() { Name = activityIdentity.Name, Version = activityIdentity.Version }, Control = (new ActivityScheduleData() { PN = activityIdentity.PositionalName }).ToJson(), ActivityId = activityIdentity.Id } }); return(historyEvents); }