public async Task <IHttpActionResult> Resources() { ClaimsPrincipal principal = this.User as ClaimsPrincipal; if (null == principal) { return(StatusCode(System.Net.HttpStatusCode.Unauthorized)); } var roles = (from c in principal.Claims where c.Type.ToLower().Contains("role") select c.Value).ToList(); ModelFactory.UserResourceResponse response = await Task.Run(() => { ModelFactory.UserResourceResponse innerResponse = new ModelFactory.UserResourceResponse(); if (roles.Contains("Affiliate")) { innerResponse.programs = MarketManager.GetPrograms(); innerResponse.unlockedPrograms = MarketManager.UnlockedPrograms(principal.Identities.First().GetUserId()); } if (roles.Contains("Vendor")) { innerResponse.affiliates = MarketManager.GetAffiliates(); innerResponse.unlockedAffiliates = MarketManager.UnlockedAffiliates(principal.Identities.First().GetUserId()); } return(innerResponse); }); return(Json <ModelFactory.UserResourceResponse>(response)); }