protected internal virtual void RemoveObsoleteEventSubscriptionsImpl(IProcessDefinitionEntity processDefinition, string eventHandlerType) { // remove all subscriptions for the previous version IEventSubscriptionEntityManager eventSubscriptionEntityManager = Context.CommandContext.EventSubscriptionEntityManager; IList <IEventSubscriptionEntity> subscriptionsToDelete = eventSubscriptionEntityManager.FindEventSubscriptionsByTypeAndProcessDefinitionId(eventHandlerType, processDefinition.Id, processDefinition.TenantId); foreach (IEventSubscriptionEntity eventSubscriptionEntity in subscriptionsToDelete) { eventSubscriptionEntityManager.Delete(eventSubscriptionEntity); } }