class RequestHandlerUtils extends AbstractRestHandler {

    protected Optional<String> getServiceInstanceIdForValidationError(ServiceInstancesRequest sir,
            HashMap<String, String> instanceIdMap, String requestScope) {
        if (instanceIdMap != null && !instanceIdMap.isEmpty() && instanceIdMap.get("serviceInstanceId") != null) {
            return Optional.of(instanceIdMap.get("serviceInstanceId"));
        } else {
            return getServiceInstanceIdForInstanceGroup(requestScope, sir);
        }
    }

}