class BBInputSetup implements JavaDelegate {

    protected ServiceInstance getALaCarteServiceInstance(Service service, RequestDetails requestDetails,
            Customer customer, Project project, OwningEntity owningEntity, Map<ResourceKey, String> lookupKeyMap,
            String serviceInstanceId, boolean aLaCarte, String bbName) throws Exception {
        ServiceInstance serviceInstance = this.getServiceInstanceHelper(requestDetails, customer, project, owningEntity,
                lookupKeyMap, serviceInstanceId, aLaCarte, service, bbName);
        org.onap.aai.domain.yang.ServiceInstance serviceInstanceAAI = null;
        if (customer != null && customer.getServiceSubscription() != null) {
            serviceInstanceAAI = bbInputSetupUtils.getAAIServiceInstanceByIdAndCustomer(customer.getGlobalCustomerId(),
                    customer.getServiceSubscription().getServiceType(), serviceInstanceId);
        } else {
            serviceInstanceAAI = bbInputSetupUtils.getAAIServiceInstanceById(serviceInstanceId);
        }
        if (serviceInstanceAAI != null
                && !serviceInstanceAAI.getModelVersionId().equalsIgnoreCase(service.getModelUUID())) {
            Service tempService =
                    this.bbInputSetupUtils.getCatalogServiceByModelUUID(serviceInstanceAAI.getModelVersionId());
            if (tempService != null) {
                serviceInstance
                        .setModelInfoServiceInstance(mapperLayer.mapCatalogServiceIntoServiceInstance(tempService));
                return serviceInstance;
            } else {
                throw new Exception(
                        "Could not find model of existing SI. Service Instance in AAI already exists with different model version id: "
                                + serviceInstanceAAI.getModelVersionId());
            }
        }
        serviceInstance.setModelInfoServiceInstance(mapperLayer.mapCatalogServiceIntoServiceInstance(service));
        return serviceInstance;
    }

}