@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);
  }
  @Override
  public CarDTO assignPoolCarToEmployee(EmployeeDTO employeeDTO, CarDTO carDTO) {
    Employee employee = employeeRepository.findOneByEmail(employeeDTO.getEmail()).get();

    updatePoolCar(carRepository.findOne(carDTO.getId()));
    Car currentCar = employee.getCurrentCar();

    if (currentCar != null) {
      Set<Car> carHistory = employee.getCarHistory();
      currentCar.setEndLeasing(LocalDate.now());
      carHistory.add(currentCar);
    }
    employee.setCurrentCar(carRepository.findOne(carDTO.getId()));
    employee.setReceivedMailForNewCar(false);
    employeeRepository.save(employee);
    return carDTO;
  }