private static void HandleException(Exception ex, Contact contact) { if (ex is AggregateException aex) { foreach (Exception iex in aex.InnerExceptions) { Log.Logger.Error(iex, $"For contact {contact?.Id} exception \"{iex.Message}\" occurred"); } } else { Log.Logger.Error(ex, $"For contact {contact?.Id} exception \"{ex.Message}\" occurred"); } CurrentStatus.ExceptionCounterAdd(1); }