class VnfAdapterCreateTasks {

    public void createVolumeGroupRequest(BuildingBlockExecution execution) {
        try {
            GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();

            ServiceInstance serviceInstance =
                    gBBInput.getCustomer().getServiceSubscription().getServiceInstances().get(0);

            GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
            VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
            VfModule vfModule;
            String sdncVfModuleQueryResponse = null;
            try {
                vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
                if (vfModule.getSelflink() != null && !vfModule.getSelflink().isEmpty()) {
                    sdncVfModuleQueryResponse = execution.getVariable(SDNCQUERY_RESPONSE + vfModule.getVfModuleId());
                } else {
                    throw new Exception("Vf Module " + vfModule.getVfModuleId()
                            + " exists in gBuildingBlock but does not have a selflink value");
                }
            } catch (BBObjectNotFoundException bbException) {
                logger.error("Exception occurred", bbException);
                // If there is not a vf module in the general building block (in aLaCarte case),
                // we will not retrieve
                // the SDNCQueryResponse and proceed as normal without throwing an error
            }

            CreateVolumeGroupRequest createVolumeGroupRequest = vnfAdapterVolumeGroupResources.createVolumeGroupRequest(
                    gBBInput.getRequestContext(), gBBInput.getCloudRegion(), gBBInput.getOrchContext(), serviceInstance,
                    genericVnf, volumeGroup, sdncVfModuleQueryResponse);
            execution.setVariable(VNFREST_REQUEST, createVolumeGroupRequest.toXmlString());
        } catch (Exception ex) {
            logger.error("Exception occurred", ex);
            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
        }
    }

}