/**
   * To map.
   *
   * @param app the app
   * @return the map
   */
  public static Map<String, String> toMap(final Appointment app) {
    final Map<String, String> properties = new HashMap<String, String>();
    properties.put(ICalConstants.SUMMARY, app.getTitle());
    properties.put(ICalConstants.DESCRIPTION, app.getDescription());
    properties.put(ICalConstants.LOCATION, app.getLocation());
    properties.put(ICalConstants.ORGANIZER, app.getCreatedBy());
    properties.put(ICalConstants._ALL_DAY, Boolean.toString(app.isAllDay()));
    properties.put(ICalConstants.UID, app.getId());

    properties.put(ICalConstants.DATE_TIME_START, DateUtils.toString(app.getStart()));
    properties.put(ICalConstants.DATE_TIME_END, DateUtils.toString(app.getEnd()));
    return properties;
  }
 /**
  * To app.
  *
  * @param properties the properties
  * @return the appointment
  * @throws Exception the exception
  */
 public static Appointment toApp(final Map<String, String> properties) throws Exception {
   final Appointment app = new Appointment();
   app.setDescription(properties.get(ICalConstants.DESCRIPTION));
   app.setTitle(properties.get(ICalConstants.SUMMARY));
   app.setLocation(properties.get(ICalConstants.LOCATION));
   app.setCreatedBy(properties.get(ICalConstants.ORGANIZER));
   final String allDay = properties.get(ICalConstants._ALL_DAY);
   app.setId(properties.get(ICalConstants.UID));
   if (allDay != null) {
     app.setAllDay(Boolean.parseBoolean(allDay));
   }
   final String start = properties.get(ICalConstants.DATE_TIME_START);
   if (start != null) {
     app.setStart(DateUtils.toDate(start));
   }
   final String end = properties.get(ICalConstants.DATE_TIME_END);
   if (end != null) {
     app.setEnd(DateUtils.toDate(end));
   }
   return app;
 }