public async Task <JsonResult> CalculatePrice(CarModel carModel)
        {
            if (carModel is null)
            {
                return(new(new Either <int, Error>(0, Errors.CarWasNull)));
            }

            var userLogin = HttpContext.User.Identity.Name;

            var car = _mapper.Map <Car>(carModel);

            var cars = await _parserService.GetCars(car);

            string jsonString = JsonSerializer.Serialize(carModel);

            var price = Predictor.PredictOnePrice(jsonString);

            var historyModel = _mapper.Map <CarHistoryModel>(car);

            historyModel.UserLogin = userLogin;
            historyModel.Price     = price;

            await _historyService.AddCarHistoryDbAsync(historyModel);

            return(new(new Either <int, Error>(price, null)));
        }
        public async Task <JsonResult> GetCarBestDeals(CarBestDealFormModel carModel)
        {
            if (carModel is null)
            {
                return(new(new Either <Car[], Error>(null, Errors.CarWasNull)));
            }

            var userLogin = HttpContext.User.Identity.Name;

            var car = _mapper.Map <Car>(carModel);

            var cars = await _parserService.GetCars(car);

            var carsJson = JsonSerializer.Serialize(cars);

            var carsBestDealDataModel = Predictor.GetBestDeals(carsJson);
            var finalCars             = JsonSerializer.Deserialize <CarBestDealDataModel[]>(carsBestDealDataModel);

            var historyModel = _mapper.Map <CarHistoryModel>(car);

            historyModel.UserLogin = userLogin;

            await _historyService.AddCarHistoryDbAsync(historyModel);

            return(new(new Either <CarBestDealDataModel[], Error>(finalCars, null)));
        }