class GeneratePayloadForCds {

    public AbstractCDSPropertiesBean buildCdsPropertiesBean(BuildingBlockExecution execution)
            throws PayloadGenerationException {

        ExecuteBuildingBlock executeBuildingBlock = execution.getVariable(BUILDING_BLOCK);
        BuildingBlock buildingBlock = executeBuildingBlock.getBuildingBlock();
        final String requestId = execution.getGeneralBuildingBlock().getRequestContext().getMsoRequestId();
        final String scope = buildingBlock.getBpmnScope();
        final String action = buildingBlock.getBpmnAction();


        CDSRequestProvider requestProvider = getRequestProviderByScope(scope);
        requestProvider.setExecutionObject(execution);

        final String requestPayload = requestProvider.buildRequestPayload(action)
                .orElseThrow(() -> new PayloadGenerationException("Failed to build payload for CDS"));

        return prepareAndSetCdsPropertyBean(requestProvider, requestPayload, requestId, action, DEFAULT_SYNC_MODE);
    }

}