class RequestHandlerUtils extends AbstractRestHandler {

    public String getServiceType(String requestScope, ServiceInstancesRequest sir, Boolean aLaCarteFlag) {
        String serviceType = null;
        if (requestScope.equalsIgnoreCase(ModelType.service.toString())) {
            String defaultServiceModelName = getDefaultModel(sir);
            org.onap.so.db.catalog.beans.Service serviceRecord;
            if (aLaCarteFlag) {
                serviceRecord = catalogDbClient.getFirstByModelNameOrderByModelVersionDesc(defaultServiceModelName);
                if (serviceRecord != null) {
                    serviceType = serviceRecord.getServiceType();
                }
            } else {
                serviceRecord =
                        catalogDbClient.getServiceByID(sir.getRequestDetails().getModelInfo().getModelVersionId());
                if (serviceRecord != null) {
                    serviceType = serviceRecord.getServiceType();
                } else {
                    serviceRecord = catalogDbClient.getFirstByModelNameOrderByModelVersionDesc(defaultServiceModelName);
                    if (serviceRecord != null) {
                        serviceType = serviceRecord.getServiceType();
                    }
                }
            }
        } else {
            serviceType = msoRequest.getServiceInstanceType(sir, requestScope);
        }
        return serviceType;
    }

}