class CarDto {
    public final String color;
    public final Option<String> ownerName;
    public final Option<Integer> ownerAge;
    public final Option<String> ownerCity;

    public CarDto(Car car) {
        this.color = car.getColor();
        Option<CarOwner> owner = car.getOwner();
        this.ownerName = owner.map(Owner::getName);
        this.ownerAge = owner.map(Owner::getAge);
        this.ownerCity = owner
            .flatMap(Owner::getAddress)
            .map(Address::getCity);
    }
}