public HttpStatusCode saveHistoricalData(string id) // convert to json { var response = new HttpResponseMessage(); HttpStatusCode res; try { Historical historical = Historical.Deserialize(id); bool idExists = _stockScreenerService.HistoricalIdExists(historical.Id); if (idExists) { return(HttpStatusCode.Ambiguous); } _stockScreenerService.Create(historical); res = response.StatusCode; } catch (Exception ex) { if (ex is System.ArgumentNullException) { Console.WriteLine("Exception " + ex); } Console.WriteLine("Exception " + ex); res = response.StatusCode; } return(res); }