protected Object invokeCommand(Object command, GfshParseResult parseResult) {
    // if no command instance is passed in, use the one in the parseResult
    if (command == null) {
      command = parseResult.getInstance();
    }

    Object result = callInvokeMethod(command, parseResult);

    if (!(command instanceof SingleGfshCommand)) {
      return result;
    }

    SingleGfshCommand gfshCommand = (SingleGfshCommand) command;
    ResultModel resultModel = (ResultModel) result;
    if (resultModel.getStatus() == Result.Status.ERROR) {
      return result;
    }

    // if command result is ok, we will need to see if we need to update cluster configuration
    InfoResultModel infoResultModel = resultModel.addInfo(ResultModel.INFO_SECTION);
    InternalConfigurationPersistenceService ccService =
        gfshCommand.getConfigurationPersistenceService();
    if (ccService == null) {
      infoResultModel.addLine(SERVICE_NOT_RUNNING_CHANGE_NOT_PERSISTED);
      return resultModel;
    }

    if (parseResult.getParamValue("member") != null) {
      infoResultModel.addLine(RUN_ON_MEMBER_CHANGE_NOT_PERSISTED);
      return resultModel;
    }

    List<String> groupsToUpdate;
    String groupInput = parseResult.getParamValueAsString("group");

    if (!StringUtils.isBlank(groupInput)) {
      groupsToUpdate = Arrays.asList(groupInput.split(","));
    } else if (gfshCommand instanceof UpdateAllConfigurationGroupsMarker) {
      groupsToUpdate = new ArrayList<>(ccService.getGroups());
    } else {
      groupsToUpdate = Collections.singletonList("cluster");
    }

    for (String group : groupsToUpdate) {
      ccService.updateCacheConfig(group, cacheConfig -> {
        try {
          if (gfshCommand.updateConfigForGroup(group, cacheConfig, resultModel.getConfigObject())) {
            infoResultModel
                .addLine("Cluster configuration for group '" + group + "' is updated.");
          } else {
            infoResultModel
                .addLine("Cluster configuration for group '" + group + "' is not updated.");
          }
        } catch (Exception e) {
          String message = "Failed to update cluster configuration for " + group + ".";
          logger.error(message, e);
          // for now, if one cc update failed, we will set this flag. Will change this when we can
          // add lines to the result returned by the command
          infoResultModel.addLine(message + ". Reason: " + e.getMessage());
          return null;
        }
        return cacheConfig;
      });
    }

    return resultModel;
  }
@return always return ResultModel for online command, for offline command, return either
        ResultModel or ExitShellRequest
geode-gfsh/src/main/java/org/apache/geode/management/internal/cli/remote/CommandExecutor.java