private static ToDoHeader todoDetailToHeader(final TodoDetail detail) {
   ToDoHeader head = new ToDoHeader();
   head.setName(detail.getName());
   head.setId(detail.getId());
   head.setDescription(detail.getDescription());
   head.setDelegatorId(detail.getDelegatorId());
   head.setStartDate(detail.getStartDate());
   head.setEndDate(detail.getEndDate());
   head.setDuration((int) detail.getDuration());
   head.setPercentCompleted(detail.getPercentCompleted());
   head.setComponentId(detail.getComponentId());
   head.setSpaceId(detail.getSpaceId());
   head.setExternalId(detail.getExternalId());
   return head;
 }
  public String addEntry(
      TodoDetail todo, boolean notifyAttendees, String txtTitle, String txtMessage) {
    SilverTrace.info("calendar", "TodoBackboneAcess.addEntry()", "root.MSG_GEN_ENTER_METHOD");
    NotificationSender notifSender = new NotificationSender(todo.getComponentId());
    try {
      ToDoHeader header = todoDetailToHeader(todo);
      SilverTrace.info(
          "calendar", "TodoBackboneAcess.addEntry()", "root.MSG_GEN_ENTER_METHOD", "apres header");
      String id = getCalendarBm().addToDo(header);
      SilverTrace.info(
          "calendar", "TodoBackboneAcess.addEntry()", "root.MSG_GEN_ENTER_METHOD", "id=" + id);

      if (todo.getAttendees() != null) {
        Collection<UserRecipient> selectedUsers = new ArrayList<UserRecipient>();
        for (Attendee attendee : todo.getAttendees()) {
          getCalendarBm().addToDoAttendee(id, attendee);
          if (notifyAttendees && (!todo.getDelegatorId().equals(attendee.getUserId()))) {
            selectedUsers.add(new UserRecipient(attendee.getUserId()));
          }
        }
        if (!selectedUsers.isEmpty()) {
          NotificationMetaData notifMetaData =
              new NotificationMetaData(NotificationParameters.NORMAL, txtTitle, txtMessage);
          notifMetaData.setSender(todo.getDelegatorId());
          notifMetaData.setUserRecipients(selectedUsers);
          notifSender.notifyUser(notifMetaData);
        }
      }
      return id;
    } catch (Exception e) {
      SilverTrace.error(
          "calendar",
          "TodoBackboneAcess.addEntry()",
          "calendar.MSG_ADD_ENTRY_FAILED",
          "value return id= null",
          e);
      return null;
    }
  }