private void addSubConfigToRoot(
      String serviceName, String subConfigName, String subConfigId, Map attrValues, int priority)
      throws CLIException {
    SSOToken adminSSOToken = getAdminSSOToken();
    IOutput outputWriter = getOutputWriter();
    String[] params = {subConfigName, serviceName};

    writeLog(LogWriter.LOG_ACCESS, Level.INFO, "ATTEMPT_ADD_SUB_CONFIGURATION", params);

    try {
      ServiceConfigManager scm = new ServiceConfigManager(serviceName, adminSSOToken);
      ServiceConfig sc = scm.getGlobalConfig(null);

      if (sc == null) {
        String[] args = {subConfigName, serviceName, "no global configiration"};
        writeLog(LogWriter.LOG_ERROR, Level.INFO, "FAILED_ADD_SUB_CONFIGURATION", args);
        String[] ar = {serviceName};
        String message =
            MessageFormat.format(
                getResourceString("add-sub-configuration-no-global-config"), (Object[]) ar);
        throw new CLIException(message, ExitCodes.REQUEST_CANNOT_BE_PROCESSED);
      }

      addSubConfig(sc, subConfigName, subConfigId, attrValues, priority);
      writeLog(LogWriter.LOG_ACCESS, Level.INFO, "SUCCEED_ADD_SUB_CONFIGURATION", params);
      outputWriter.printlnMessage(
          MessageFormat.format(
              getResourceString("add-sub-configuration-succeed"), (Object[]) params));
    } catch (SSOException e) {
      String[] args = {subConfigName, serviceName, e.getMessage()};
      debugError("AddSubConfiguration.addSubConfigToRoot", e);
      writeLog(LogWriter.LOG_ERROR, Level.INFO, "FAILED_ADD_SUB_CONFIGURATION", args);
      throw new CLIException(e, ExitCodes.REQUEST_CANNOT_BE_PROCESSED);
    } catch (SMSException e) {
      e.printStackTrace();
      String[] args = {subConfigName, serviceName, e.getMessage()};
      debugError("AddSubConfiguration.addSubConfigToRoot", e);
      writeLog(LogWriter.LOG_ERROR, Level.INFO, "FAILED_ADD_SUB_CONFIGURATION", args);
      throw new CLIException(e, ExitCodes.REQUEST_CANNOT_BE_PROCESSED);
    }
  }