public void deleteCustomField(CustomField field) throws ApplicationException {
   if (field == null
       || ConvertUtil.isNullOrEmpty(field.getEntityName())
       || ConvertUtil.isNullOrEmpty(field.getFieldName())) {
     log.warn("The custom field to be deleted is invalid: " + field);
     throw new ApplicationException("Unable to add invalid custom field definition.");
   }
   Entity entity = findLatestEntityVersionByName(field.getEntityName());
   EntityAttribute attrib = null;
   for (EntityAttribute item : entity.getAttributes()) {
     if (item.getName().equalsIgnoreCase(field.getFieldName()) && item.getDateVoided() == null) {
       attrib = item;
     }
   }
   if (attrib == null) {
     log.info("The user attempted to delete a custom field that does not exist.");
     throw new ApplicationException("Unable to delete an unknown custom field definition.");
   }
   attrib.setDateVoided(new Date());
   attrib.setUserVoidedBy(Context.getUserContext().getUser());
   try {
     entityDefinitionDao.updateEntity(entity);
     // Generate a notification event to inform interested listeners via the lightweight mechanism
     // that this event has occurred.
     Context.notifyObserver(ObservationEventType.CUSTOM_FIELD_DELETE_EVENT, field);
   } catch (DaoException e) {
     log.error("Failed while deleting a custom field: " + e, e);
     throw new ApplicationException("Failed while deleting the custom field: " + e.getMessage());
   }
 }