public void setLastOrder(OrderPurchase lastOrder) {
   if (lastOrders != null && Hibernate.isInitialized(lastOrders) && lastOrder != null) {
     for (OrderPurchase orderPurchase : lastOrders) {
       if (orderPurchase != null
           && getCurrentMarketArea() != null
           && getCurrentMarketAreaRetailer() != null
           && orderPurchase.getMarketAreaId().equals(getCurrentMarketArea().getId())
           && orderPurchase.getRetailerId().equals(getCurrentMarketAreaRetailer().getId()))
         lastOrders.remove(orderPurchase);
     }
     lastOrders.add(lastOrder);
   }
 }
 public OrderPurchase getLastOrder() {
   if (lastOrders != null && Hibernate.isInitialized(lastOrders)) {
     for (OrderPurchase orderPurchase : lastOrders) {
       if (orderPurchase != null
           && getCurrentMarketArea() != null
           && getCurrentMarketAreaRetailer() != null
           && orderPurchase.getMarketAreaId().equals(getCurrentMarketArea().getId())
           && orderPurchase.getRetailerId().equals(getCurrentMarketAreaRetailer().getId()))
         return orderPurchase;
     }
   }
   return null;
 }