class WorkflowAction {

    protected String validateNetworkResourceIdInAAI(String generatedResourceId, String instanceName,
            RequestDetails reqDetails, WorkflowResourceIds workflowResourceIds)
            throws DuplicateNameException, MultipleObjectsFoundException {
        Optional<L3Network> network = bbInputSetupUtils
                .getRelatedNetworkByNameFromServiceInstance(workflowResourceIds.getServiceInstanceId(), instanceName);
        if (network.isPresent()) {
            if (network.get().getModelCustomizationId()
                    .equalsIgnoreCase(reqDetails.getModelInfo().getModelCustomizationId())) {
                return network.get().getNetworkId();
            } else {
                throw new DuplicateNameException("l3Network", String.format(NAME_EXISTS_WITH_DIFF_CUSTOMIZATION_ID,
                        instanceName, network.get().getModelCustomizationId()));
            }
        }
        if (bbInputSetupUtils.existsAAINetworksGloballyByName(instanceName)) {
            throw new DuplicateNameException("l3Network", String.format(NAME_EXISTS_WITH_DIFF_PARENT, instanceName,
                    workflowResourceIds.getServiceInstanceId()));
        }
        return generatedResourceId;
    }

}