public IEnumerable <NewsSource> GetSources() { string key = op.Value.Cache.NewsSourcesKey; List <NewsSource> sources; if (cache.TryGetValue(key, out sources)) { return(sources); } sources = new List <NewsSource>(); List <NewsProviderDef> providers = db.NewsProviderDefs.AsNoTracking().Where(x => !x.Locked).ToList(); providers .ForEach(x => { INewsProvider provider = factory.GetProvider(x); sources.AddRange(provider.GetSources()); }); sources = sources.OrderBy(x => x.NewsSourceId).ToList(); cache.Set(key, sources, new MemoryCacheEntryOptions() .SetAbsoluteExpiration(TimeSpan.FromMinutes(op.Value.Cache.NewsSourcesRefreshInterval))); return(sources); }