private void AddActivityInstanceId(IActivityExecution execution, IDictionary <string, IList <ActivityInstance> > instanceMap) { var actId = execution.Activity.Id; var actInstanceId = execution.ActivityInstanceId; var parentActInstanceId = execution.ParentActivityInstanceId; var executionId = execution.GetHashCode().ToString(); // add to instance map IList <ActivityInstance> instancesForThisAct; instanceMap.TryGetValue(actId, out instancesForThisAct); if (instancesForThisAct == null) { instancesForThisAct = new List <ActivityInstance>(); instanceMap[actId] = instancesForThisAct; } var activityInstance = new ActivityInstance(this, executionId, actInstanceId, parentActInstanceId, execution.IsCompleteScope); instancesForThisAct.Add(activityInstance); }