public int compare(Presentation p1, Presentation p2) {
   final Agent p1Owner = p1.getOwner();
   final Agent p2Owner = p2.getOwner();
   if (p1Owner == null) {
     if (p2Owner == null) {
       return 0;
     } else {
       return -1;
     }
   } else if (p2Owner == null) {
     return 1;
   } else {
     // get the sort names
     String name1 = p1Owner.getDisplayName();
     String name2 = p2Owner.getDisplayName();
     try {
       name1 = UserDirectoryService.getUserByEid(p1Owner.getEid().getValue()).getSortName();
     } catch (Exception e) {
       // nothing to do
     }
     try {
       name2 = UserDirectoryService.getUserByEid(p2Owner.getEid().getValue()).getSortName();
     } catch (Exception e) {
       // nothing to do
     }
     int result = stringComparator.compare(name1, name2);
     if (result == 0) {
       result = nameComparator.compare(p1, p2);
     }
     return result;
   }
 }
    public final int compare(Presentation p1, Presentation p2) {
      final Date p1Modified = p1.getModified();
      final Date p2Modified = p2.getModified();

      if (p1Modified == null) {
        if (p2Modified == null) {
          return 0;
        } else {
          return -1;
        }
      } else if (p2Modified == null) {
        return 1;
      } else {
        int result = p1Modified.compareTo(p2Modified);
        if (result == 0) {
          result = nameComparator.compare(p1, p2);
        }
        return result;
      }
    }