private String search(MemoriCommand command, GoogleSync googleSync) {
    String text = command.getName();
    MemoriEvent taskLine;
    MemoriEvent displayText;
    for (int i = 0; i < memoriCalendar.size(); i++) {
      taskLine = memoriCalendar.get(i);
      String name = taskLine.getName();
      String description = taskLine.getDescription();
      String location = taskLine.getLocation();
      if (command.getStart() != null) {
        if (command.getStart() == taskLine.getStart()) {
          displayText = memoriCalendar.get(i);
          searchedList.add(displayText);
        }
      } else {
        if (command.getEnd() != null) {
          if (command.getEnd() == taskLine.getEnd()) {
            displayText = memoriCalendar.get(i);
            searchedList.add(displayText);
          }
        } else {
          if ((name.contains(text)) || (description.contains(text)) || (location.contains(text))) {
            displayText = memoriCalendar.get(i);
            searchedList.add(displayText);
          }
        }
      }
    }

    if (!searchedList.isEmpty()) {
      String paddedNameHeader = padRight(NAME_HEADER, MemoriEvent.NAME_CUT_OFF);
      String paddedStartHeader = padRight(START_HEADER, MemoriEvent.DATE_FORMAT.length());
      String output =
          String.format(
              DISPLAY_FORMAT, INDEX_HEADER, paddedNameHeader, paddedStartHeader, END_HEADER);
      int i = 1;
      for (MemoriEvent e : searchedList) {
        String index = padRight(Integer.toString(i), INDEX_HEADER.length());
        output += index + " " + e.display() + "\n";
        i++;
      }
      return output;
    } else {
      return MESSAGE_INVALID_KEYWORD;
    }
  }
  public String add(MemoriCommand command, GoogleSync googleSync) {
    if (maxIdSet == false) findMaxId();
    maxId++;
    MemoriEvent event =
        new MemoriEvent(
            command.getName(),
            command.getStart(),
            command.getEnd(),
            maxId,
            "google",
            command.getDescription(),
            command.getLocation());

    memoriCalendar.add(event);
    googleSync.executeCommand(event, command);

    return MESSAGE_ADD;
  }
  private String update(MemoriCommand command, GoogleSync googleSync) {
    MemoriEvent originalEvent;
    if (memoriCalendar.isEmpty()) {
      return MESSAGE_EMPTYFILE;
    } else {
      int index = command.getIndex();

      if (memoriCalendar.size() < index) {
        return LINE_INDEX_DOES_NOT_EXISTS;
      } else {
        originalEvent = memoriCalendar.get(index - 1);
        originalEvent.update(
            command.getName(),
            command.getStart(),
            command.getEnd(),
            command.getDescription(),
            command.getLocation());
        googleSync.executeCommand(originalEvent, command);
        return String.format(MESSAGE_UPDATE, index);
      }
    }
  }