class WorkflowAction {

    protected String validateVnfResourceIdInAAI(String generatedResourceId, String instanceName,
            RequestDetails reqDetails, WorkflowResourceIds workflowResourceIds) throws DuplicateNameException {
        Optional<GenericVnf> vnf = bbInputSetupUtils
                .getRelatedVnfByNameFromServiceInstance(workflowResourceIds.getServiceInstanceId(), instanceName);
        if (vnf.isPresent()) {
            if (vnf.get().getModelCustomizationId()
                    .equalsIgnoreCase(reqDetails.getModelInfo().getModelCustomizationId())) {
                return vnf.get().getVnfId();
            } else {
                throw new DuplicateNameException("generic-vnf", String.format(NAME_EXISTS_WITH_DIFF_CUSTOMIZATION_ID,
                        instanceName, vnf.get().getModelCustomizationId()));
            }
        }
        GenericVnfs vnfs = bbInputSetupUtils.getAAIVnfsGloballyByName(instanceName);
        if (vnfs != null) {
            throw new DuplicateNameException("generic-vnf",
                    String.format(NAME_EXISTS_WITH_DIFF_PARENT, instanceName, vnfs.getGenericVnf().get(0).getVnfId()));
        }
        return generatedResourceId;
    }

}