private Groups loadGroups( IGroupDataAccess groupDataAccess, ILogger log, IConfigValues config, ICaching cache, CacheItem cachedGroup) { Groups group = null; try { group = new Groups(groupDataAccess, log); cache.Insert(GROUP_CACHE_KEY, group); } catch (Exception exception) { log.Write( "An error occurred trying to load the GROUP information. " + "Likely this is because of a corrupted data in the file. " + (config.FailBehavior == FailBehaviorEnum.FailWithCorruptedFile ? "This request will fail, and it's likely that all other requests " + "will as well. Please have someone look at this as soon as possible." : "The service is configured to use the cached data, so the service will " + "continue to work as normal (just without the changes made to the file. " + "Someone will need to address the file issue soon, as GROUP data will get stale."), LogEntrySeverityEnum.Error, exception); if (null == cachedGroup || null == cachedGroup.Obj || config.FailBehavior == FailBehaviorEnum.FailWithCorruptedFile) { throw; } group = (Groups)cachedGroup.Obj; } return(group); }