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;
  }
  @Override
  public CarDTO assignCarToEmployee(
      Order order, int leasingDurationInYears, String numberPlate, String vinNumber) {
    Employee employee = order.getEmployee();
    if (employee.getCurrentCar() != null) {
      moveCurrentCarToCarHistory(employee);
    }

    Car car = createNewCarFromOrder(order, leasingDurationInYears, numberPlate, vinNumber);

    employee.setCurrentCar(car);

    employeeRepository.save(employee);
    return CarMapper.mapCarObjectToCarDTO(car);
  }