public async Task <IActionResult> SearchFields([FromServices] IReportsRepository data) { string cacheKey = "customfields"; bool cacheExists = _cache.TryGetItem(cacheKey, _lastUpdated, out CustomSearchFields fields); if (!cacheExists) { fields = await data.GetCustomFields(); _cache.AddItem(cacheKey, _lastUpdated, fields); } return(Content(JsonConvert.SerializeObject(fields), "application/json")); }