for (Order order : customer.getOrders()) {
Order newOrder = new Order(order.getOrderNumber());
setId(newOrder, order.getId());
result.addToOrders(newOrder);
for (OrderLine line : order.getOrderLines()) {
OrderLine newLine = new OrderLine(line.getLineNumber(), line.getDescription());
newLine.setProduct(line.getProduct());
setId(newLine, line.getId());
newOrder.addToOrderLines(newLine);
}
}
return result;