@Override
 public void deleteExternalApplication(Long id)
     throws CvqModelException, CvqObjectNotFoundException {
   ExternalApplication ea = getExternalApplicationById(id);
   if (ea.getExternalHomeFolders() != null) {
     //            List<ExternalAccountItem> externalAccountItems =
     // paymentService.getAllExternalAccountItems();
     //            for (ExternalAccountItem eai : externalAccountItems) {
     //                if
     // (eai.getExternalServiceSpecificDataByKey(ExternalServiceUtils.EXTERNAL_APPLICATION_ID_KEY).equals(String.valueOf(ea.getId()))) {
     //                    externalAccountItems.remove(eai);
     //                    eai.setExternalServiceSpecificData(null);
     //                    genericDAO.delete(eai);
     //                }
     //            }
     for (ExternalHomeFolder externalHomeFolder : ea.getExternalHomeFolders()) {
       externalHomeFolderService.deleteHomeFolderMappings(
           ea.getLabel(),
           externalHomeFolderService
               .getHomeFolderMapping(ea.getLabel(), externalHomeFolder.getExternalId())
               .getHomeFolderId());
       genericDAO.delete(externalHomeFolder);
     }
     ea.setExternalHomeFolders(null);
   }
   genericDAO.delete(ea);
 }