private String buildFreeBusyAttendeeResponse(
     Profile attendee, ICalFormatter.FreeBusyRequest request, String domain, String attendeeMailto)
     throws NotAuthorizedException, BadRequestException {
   Date start = request.getStart();
   Date finish = request.getFinish();
   List<EventResourceImpl> list = new ArrayList<>();
   if (attendee.getCalendars() != null) {
     for (Calendar cal : attendee.getCalendars()) {
       if (cal.getEvents() != null) {
         for (CalEvent event : cal.getEvents()) {
           if (!outsideDates(event, start, finish)) {
             EventResourceImpl er = new EventResourceImpl();
             er.setEnd(event.getEndDate());
             er.setStart(event.getStartDate());
             er.setSummary(er.getSummary());
             er.setUniqueId(er.getUniqueId());
             list.add(er);
             log.info("** INSIDE: " + event.getSummary());
           } else {
             log.info("Outside dates: " + event.getSummary());
           }
         }
       }
     }
   }
   return formatter.buildFreeBusyAttendeeResponse(list, request, domain, attendeeMailto);
 }
  private boolean outsideDates(CalEvent event, Date start, Date end) {
    if (start != null) {
      if (event.getStartDate().before(start)) {
        log.info(" before start: " + event.getStartDate() + " < " + start);
        return true;
      }
    }

    if (end != null) {
      if (event.getEndDate().after(end)) {
        log.info(" after end: " + event.getEndDate() + " < " + end);
        return true;
      }
    }

    return false;
  }