public void print() {
    StringBuilder sb = new StringBuilder();
    for (MenuItem mi : currentMenu.getMenuItems()) {
      sb.append(mi.getTitle() + System.lineSeparator());
    }

    IOUtil.print(sb.toString());
  }
  public boolean navigate(int index, ObjectInputStream in, ObjectOutputStream out) {
    if (this.currentMenu != null) {
      if ((index < currentMenu.getMenuItems().size()) && (index >= 0)) {
        try {
          if (this.currentMenu.getItem(index).getAction() != null) {

            out.writeObject((this.currentMenu.getItem(index).sendCommandMessage()));
            out.flush();

            if (in.readObject() != null) {
              this.currentMenu.getItem(index).receiveAnswer(in.readObject());
            }
          }
          if ((this.currentMenu.getItem(index).getAction() != null)
              && (this.currentMenu.getItem(index).getMenu() == null)) {
            out.writeObject(new CommandMessage(EXIT, null));
          }

        } catch (IOException | ClassNotFoundException e) {

          logger.error(EXCEPTION_FOUND, e);
        }
        setCurrentMenu(this.currentMenu.getItem(index).getMenu());

      } else {
        setCurrentMenu(null);
      }
      return true;
    } else {

      try {
        out.writeObject(new CommandMessage(EXIT, null));
        this.currentMenu.getItem(index).receiveAnswer(in.readObject());
      } catch (IOException | ClassNotFoundException e) {

        logger.error(EXCEPTION_FOUND, e);
      }

      return false;
    }
  }