@Override
 public void delete(Long id) {
   try {
     Accompaniment findById = accompanimentDAO.findById(id, null);
     deleteAssociations(findById);
     Accompaniment expurge = new Accompaniment();
     expurge.setId(id);
     accompanimentDAO.update(expurge);
     accompanimentDAO.delete(expurge);
   } catch (Exception e) {
     LOGGER.error("DELETE ASSOCIATIONS ERROR ->> " + e);
   }
 }
 @Override
 public void removeMedia(Long id, MediaTypeEnum mediaType) {
   List<AccompanimentMedia> findBy =
       accompanimentMediaDAO.listByAccompaniment(id, mediaType.getId());
   for (AccompanimentMedia accompanimentMedia : findBy) {
     accompanimentMedia.setAccompaniment(null);
     accompanimentMediaDAO.update(accompanimentMedia);
   }
   Accompaniment findById = accompanimentDAO.findById(id, null);
   if (MediaTypeEnum.PHOTO.equals(mediaType)) {
     findById.setPhotoName(null);
     accompanimentDAO.update(findById);
   } else if (MediaTypeEnum.VIDEO.equals(mediaType)) {
     findById.setVideoName(null);
     accompanimentDAO.update(findById);
   }
 }
 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);
 }