class ConfigurationScaleOut {

    public void callAppcClient(BuildingBlockExecution execution) {
        logger.trace("Start runAppcCommand ");
        String appcCode = "1002";
        String appcMessage = "";
        try {
            Action commandAction = Action.valueOf(execution.getVariable(ACTION));
            String msoRequestId = execution.getVariable(MSO_REQUEST_ID);
            String vnfId = execution.getVariable(VNF_ID);
            Optional<String> payloadString = null;
            if (execution.getVariable(PAYLOAD) != null) {
                String pay = execution.getVariable(PAYLOAD);
                payloadString = Optional.of(pay);
            }
            String controllerType = execution.getVariable(CONTROLLER_TYPE);
            HashMap<String, String> payloadInfo = new HashMap<>();
            payloadInfo.put(VNF_NAME, execution.getVariable(VNF_NAME));
            payloadInfo.put(VFMODULE_ID, execution.getVariable(VFMODULE_ID));
            logger.debug("Running APP-C action: {}", commandAction.toString());
            logger.debug("VNFID: {}", vnfId);
            // PayloadInfo contains extra information that adds on to payload before making request to appc
            appCClient.runAppCCommand(commandAction, msoRequestId, vnfId, payloadString, payloadInfo, controllerType);
            appcCode = appCClient.getErrorCode();
            appcMessage = appCClient.getErrorMessage();

        } catch (Exception e) {
            logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION.toString(),
                    "Caught exception in runAppcCommand in ConfigurationScaleOut", "BPMN",
                    ErrorCode.UnknownError.getValue(), "APPC Error", e);
            appcMessage = e.getMessage();
        }
        logger.error("Error Message: " + appcMessage);
        logger.error("ERROR CODE: " + appcCode);
        logger.trace("End of runAppCommand ");
        if (appcCode != null && !("0").equals(appcCode)) {
            exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(appcCode), appcMessage);
        }
    }

}