public Prediction PredictWithTags([FromBody] HousePredictionTags model)
        {
            if(model == null)
                model = new HousePredictionTags();

            var result = EstatePrediction.PredictWithHouseTags(model).Result;

            var data = (JObject)JsonConvert.DeserializeObject(result);
            if (data["Results"] != null)
            {
                return new Prediction()
                {
                    price = (string) data["Results"]["output1"]["value"]["Values"][0][31],
                    error = (string) data["Results"]["output1"]["value"]["Values"][0][32]
                };
            }

            return null;
        }
        public static HousePredictionTags GetPredictionTags(List<string> tags)
        {
            var output = new HousePredictionTags();

            foreach (var tag in tags)
            {
                switch (tag.ToLower())
                {
                    case "asking price":
                        output.asking_price = true;
                        break;
                    case "landscape":
                        output.landscape = true;
                        break;
                    case "scenic":
                        output.scenic = true;
                        break;
                    case "travel":
                        output.travel = true;
                        break;
                    case "environment":
                        output.environment = true;
                        break;
                    case "patio":
                        output.patio = true;
                        break;
                    case "parquet":
                        output.parquet = true;
                        break;
                    case "mansion":
                        output.mansion = true;
                        break;
                    case "yard":
                        output.yard = true;
                        break;
                    case "architecture":
                        output.architecture = true;
                        break;
                    case "interior design":
                        output.interior_design = true;
                        break;
                    case "barn":
                        output.barn = true;
                        break;
                    case "comfort":
                        output.comfort = true;
                        break;
                    case "swimming pool":
                        output.swimming_pool = true;
                        break;
                    case "garage":
                        output.garage = true;
                        break;
                    case "suburb":
                        output.suburb = true;
                        break;
                    case "porch":
                        output.porch = true;
                        break;
                    case "flora":
                        output.flora = true;
                        break;
                    case "modern":
                        output.modern = true;
                        break;
                    case "classic":
                        output.classic = true;
                        break;
                    case "gazebo":
                        output.gazebo = true;
                        break;
                    case "villa":
                        output.villa = true;
                        break;
                    case "hotel":
                        output.hotel = true;
                        break;
                    case "old":
                        output.old = true;
                        break;
                    case "fireplace":
                        output.fireplace = true;
                        break;
                    case "minimalist":
                        output.minimalist = true;
                        break;
                    case "luxury":
                        output.luxury = true;
                        break;
                    case "pavement":
                        output.pavement = true;
                        break;
                    case "pool":
                        output.pool = true;
                        break;
                    case "contemporary":
                        output.contemporary = true;
                        break;
                    case "final amount":
                        output.final_amount = true;
                        break;
                }
            }

            return output;
        }
        public static async Task<string> PredictWithHouseTags(HousePredictionTags model)
        {
            using (var client = new HttpClient())
            {
                var scoreRequest = new
                {

                    Inputs = new Dictionary<string, StringTable>() {
                        {
                            "input1",
                            new StringTable()
                            {
                                ColumnNames = new string[]
                                {
                                    "classic",
                                    "architecture",
                                    "comfort",
                                    "interior design",
                                    "modern",
                                    "barn",
                                    "parquet",
                                    "garage",
                                    "yard",
                                    "landscape",
                                    "fireplace",
                                    "patio",
                                    "villa",
                                    "scenic",
                                    "minimalist",
                                    "number_of_bathrooms",
                                    "hotel",
                                    "suburb",
                                    "porch",
                                    "environment",
                                    "swimming pool",
                                    "travel",
                                    "gazebo",
                                    "pool",
                                    "flora",
                                    "luxury",
                                    "contemporary",
                                    "mansion",
                                    "pavement",
                                    "old",
                                    "final_amount"
                                },
                                Values = new string[,]
                                {
                                    {
                                        Convert.ToInt32(model.classic).ToString(),
                                        Convert.ToInt32(model.architecture).ToString(),
                                        Convert.ToInt32(model.comfort).ToString(),
                                        Convert.ToInt32(model.interior_design).ToString(),
                                        Convert.ToInt32(model.modern).ToString(),
                                        Convert.ToInt32(model.barn).ToString(),
                                        Convert.ToInt32(model.parquet).ToString(),
                                        Convert.ToInt32(model.garage).ToString(),
                                        Convert.ToInt32(model.yard).ToString(),
                                        Convert.ToInt32(model.landscape).ToString(),
                                        Convert.ToInt32(model.fireplace).ToString(),
                                        Convert.ToInt32(model.patio).ToString(),
                                        Convert.ToInt32(model.villa).ToString(),
                                        Convert.ToInt32(model.scenic).ToString(),
                                        Convert.ToInt32(model.minimalist).ToString(),
                                        Convert.ToInt32(model.number_of_bathrooms).ToString(),
                                        Convert.ToInt32(model.hotel).ToString(),
                                        Convert.ToInt32(model.suburb).ToString(),
                                        Convert.ToInt32(model.porch).ToString(),
                                        Convert.ToInt32(model.environment).ToString(),
                                        Convert.ToInt32(model.swimming_pool).ToString(),
                                        Convert.ToInt32(model.travel).ToString(),
                                        Convert.ToInt32(model.gazebo).ToString(),
                                        Convert.ToInt32(model.pool).ToString(),
                                        Convert.ToInt32(model.flora).ToString(),
                                        Convert.ToInt32(model.luxury).ToString(),
                                        Convert.ToInt32(model.contemporary).ToString(),
                                        Convert.ToInt32(model.mansion).ToString(),
                                        Convert.ToInt32(model.pavement).ToString(),
                                        Convert.ToInt32(model.old).ToString(),
                                        Convert.ToInt32(model.final_amount).ToString()
                                    },  { "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0" },
                                }
                            }
                        },
                    },
                    GlobalParameters = new Dictionary<string, string>()
                    {
                    }
                };
                const string apiKey = "trj+qROzUANxmGQcGOsT7Gzkre6WyQW4bvWHLai532x3uo0gkw42wO/Y6NxiI0/QBjmdmpclbty33KR0fKiu4A=="; // Replace this with the API key for the web service
                client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", apiKey);

                client.BaseAddress = new Uri("https://ussouthcentral.services.azureml.net/workspaces/b73bf374bbba41219bb7fb317bfd4048/services/93bad5a3a06c45e5beb4ccecd12fa98c/execute?api-version=2.0&details=true");

                var response = await client.PostAsJsonAsync("", scoreRequest).ConfigureAwait(false); ;

                if (response.IsSuccessStatusCode)
                {
                    return await response.Content.ReadAsStringAsync();
                }
                
                return await response.Content.ReadAsStringAsync();
            }
        }