public HttpStatusCode saveTempHistoricalData(string data) // convert to json { var response = new HttpResponseMessage(); HttpStatusCode res; try { TempHistorical historical = TempHistorical.Deserialize(data); bool idExists = _stockScreenerService.TempHistoricalIdExists(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); }