class WorkflowAction {

    protected String validateVolumeGroupResourceIdInAAI(String generatedResourceId, String instanceName,
            RequestDetails reqDetails, WorkflowResourceIds workflowResourceIds) throws DuplicateNameException {
        Optional<VolumeGroup> volumeGroup =
                bbInputSetupUtils.getRelatedVolumeGroupByNameFromVnf(workflowResourceIds.getVnfId(), instanceName);
        if (volumeGroup.isPresent()) {
            if (volumeGroup.get().getVfModuleModelCustomizationId()
                    .equalsIgnoreCase(reqDetails.getModelInfo().getModelCustomizationId())) {
                return volumeGroup.get().getVolumeGroupId();
            } else {
                throw new DuplicateNameException("volumeGroup", volumeGroup.get().getVolumeGroupName());
            }
        }
        if (bbInputSetupUtils.existsAAIVolumeGroupGloballyByName(instanceName)) {
            throw new DuplicateNameException("volumeGroup", instanceName);
        }
        return generatedResourceId;
    }

}