private async Task <T> GetDataAsync <E, M, T>(string cacheKey, Func <Func <E, M>, T> getData, Func <E, M> transformData) where T : class { var data = IsCacheEnabled ? InnerCache.GetAsync <T>(cacheKey) : Task.FromResult(default(T)); return(await data.ContinueWith <T>(t => { var returnValue = t.Result; if (t.Result == null) { returnValue = getData(transformData); } return returnValue; })); }