private List<?> listToMessage(List<?> values) {
      if (values.isEmpty() || !(values.get(0) instanceof Message)) {
        return values;
      }
      List<Object> messages = new ArrayList<>();
      for (Object operation : values) {
        messages.add(((Message) operation).toMessage());
      }
      return messages;
    }