public Car createNewCarFromOrder( Order order, int leasingDurationInYears, String numberPlate, String vinNumber) { Car car = new Car(); car.setCarType(order.getCarType()); if (order.getOptions().size() > 1) { List<CarOption> optionList = order.getOptions(); car.setCarOptions(optionList); } car.setLeasingDurationYears(leasingDurationInYears); car.setNumberPlate(numberPlate); car.setStartLeasing(LocalDate.now()); car.setVinNumber(vinNumber); orderRepository.delete(order); carRepository.save(car); return car; }