public static async Task <RemoteSite> AuthorizeApiAsync(string apiKey) { try { if (apiKey == null) { return(null); } RemoteSite site = null; site = await SiteCache.GetSiteByApiKey(HttpRuntime.Cache, apiKey.ToString()); if (site == null) { return(null); } //we're authenticated return(site); } catch (Exception ex) { throw new Exception("Error authorizing access", ex); } }