private void deleteFoodAssociations(Accompaniment root) {
   List<Food> foods = foodDAO.listByAccompanimentId(root.getId());
   for (Food food : foods) {
     Collection<Accompaniment> accompaniments = accompanimentDAO.listByFoodId(food.getId());
     Collection<Accompaniment> retainAll = new ArrayList<Accompaniment>();
     for (Accompaniment accompaniment : accompaniments) {
       if (!accompaniment.getId().equals(root.getId())) {
         retainAll.add(accompaniment);
       }
     }
     accompaniments.retainAll(retainAll);
     food.setAccompaniments(new HashSet<Accompaniment>(accompaniments));
     foodDAO.update(food);
   }
   root.setFoods(null);
 }
 private void deletePromotionAssociations(Accompaniment root) {
   List<Promotion> promotions = promotionDAO.listByAccompanimentId(root.getId());
   for (Promotion promotion : promotions) {
     promotion.setAccompaniments(null);
     promotionDAO.update(promotion);
   }
   root.setPromotions(null);
 }
 private void deleteOrderItemAssociations(Accompaniment root) {
   List<OrderItem> orderItens = orderItemDAO.listByAccompanimentId(root.getId());
   for (OrderItem item : orderItens) {
     item.setAccompaniments(null);
     orderItemDAO.update(item);
   }
   root.setOrderItems(null);
 }
 private void deleteMediaAssociations(Accompaniment root) {
   if (root.getPhotoName() != null) {
     List<AccompanimentMedia> medias =
         accompanimentMediaDAO.listByAccompaniment(root.getId(), MediaTypeEnum.PHOTO.getId());
     for (AccompanimentMedia accompanimentMedia : medias) {
       accompanimentMedia.setAccompaniment(null);
       accompanimentMediaDAO.update(accompanimentMedia);
       accompanimentMediaDAO.delete(accompanimentMedia);
     }
   }
   if (root.getVideoName() != null) {
     List<AccompanimentMedia> medias =
         accompanimentMediaDAO.listByAccompaniment(root.getId(), MediaTypeEnum.VIDEO.getId());
     for (AccompanimentMedia accompanimentMedia : medias) {
       accompanimentMedia.setAccompaniment(null);
       accompanimentMediaDAO.update(accompanimentMedia);
       accompanimentMediaDAO.delete(accompanimentMedia);
     }
   }
 }