void ResolveUsing( ConflictResolution conflictResolution, TriggerManager triggerManager, TriggerEntity newTriggerEntity, [CanBeNull] ITrigger existingTrigger) { if (conflictResolution == ConflictResolution.Skip) { return; } else if (conflictResolution == ConflictResolution.Replace) { if (existingTrigger == null) { throw new InvalidOperationException("existingTrigger is null"); } var existingTriggerEntity = existingTrigger.GetTriggerEntityCopy(serializer); triggerManager.RemoveTrigger(existingTrigger); try { triggerManager.CreateTriggerFromEntity(newTriggerEntity); } catch (Exception exception) { logger.Error(exception, $"Error at trigger creation attempt (replace): {newTriggerEntity.GetDescription()}"); try { triggerManager.CreateTriggerFromEntity(existingTriggerEntity); } catch (Exception innerException) { logger.Error(innerException, $"Error at trigger recreate attempt: {existingTriggerEntity.GetDescription()}"); } throw; } } else if (conflictResolution == ConflictResolution.ImportAsNew) { newTriggerEntity.TriggerId = Guid.NewGuid(); if (existingTrigger != null && newTriggerEntity.Name == existingTrigger.Name) { newTriggerEntity.Name = newTriggerEntity.Name + GetStampText(); } try { triggerManager.CreateTriggerFromEntity(newTriggerEntity); } catch (Exception exception) { logger.Error(exception, $"Error at trigger creation attempt (import as new): {newTriggerEntity.GetDescription()}"); throw; } } }