private RecurrenceRuleException[] LoadExceptions(RecurrenceRule recurrence) { try { log.LogFunctionStart(); log.Log("Loading exceptions ...", LogLevel.Debug); recurrence.LoadRelation(RecurrenceRule.RelationNames.Exceptions, service, "*"); recurrence.LoadRelation(RecurrenceRule.RelationNames.ExceptionGroupings, service, "*"); var exceptions = new RecurrenceRuleException[0]; if (recurrence.Exceptions != null) { exceptions = exceptions.Union(recurrence.Exceptions).ToArray(); } if (recurrence.ExceptionGroupings != null) { log.Log("Loading exceptions in groupings ...", LogLevel.Debug); foreach (var grouping in recurrence.ExceptionGroupings) { grouping.LoadRelation(RecurrenceRuleExceptionGrouping.RelationNames.Exceptions, service, "*"); if (grouping.Exceptions != null) { exceptions = exceptions.Union(grouping.Exceptions).ToArray(); } } } log.Log($"Exceptions count: {exceptions.Length}"); return(exceptions); } catch (Exception ex) { log.Log(ex); throw; } finally { log.LogFunctionEnd(); } }