class WorkflowAction {

    protected String validateVfModuleResourceIdInAAI(String generatedResourceId, String instanceName,
            RequestDetails reqDetails, WorkflowResourceIds workflowResourceIds) throws DuplicateNameException {
        GenericVnf vnf = bbInputSetupUtils.getAAIGenericVnf(workflowResourceIds.getVnfId());
        if (vnf != null && vnf.getVfModules() != null) {
            for (org.onap.aai.domain.yang.VfModule vfModule : vnf.getVfModules().getVfModule()) {
                if (vfModule.getVfModuleName().equalsIgnoreCase(instanceName)) {
                    if (vfModule.getModelCustomizationId()
                            .equalsIgnoreCase(reqDetails.getModelInfo().getModelCustomizationId())) {
                        return vfModule.getVfModuleId();
                    } else {
                        throw new DuplicateNameException("vfModule",
                                String.format(NAME_EXISTS_WITH_DIFF_CUSTOMIZATION_ID, instanceName,
                                        reqDetails.getModelInfo().getModelCustomizationId()));
                    }
                }
            }
        }
        if (bbInputSetupUtils.existsAAIVfModuleGloballyByName(instanceName)) {
            throw new DuplicateNameException("vfModule", instanceName);
        }
        return generatedResourceId;
    }

}