private JSONObject getExtendedFeed(JSONArray discoFeed, HttpServletRequest request) {
        JSONObject json = new JSONObject();
        String lastIdp = "";
        Cookie[] cookies = request.getCookies();
        if (cookies != null) {
            for (Cookie cookie : cookies) {
                String name = cookie.getName();
                if (name.equals("lastIdp")) {
                    lastIdp = cookie.getValue();
                }
            }
        }
        try {
            JSONArray lia = new JSONArray();
            lia.put((new JSONObject()).accumulate("entityID", lastIdp));
            json.put("last", lia);
        } catch (JSONException ex) {
            LOG.log(Level.INFO, null, ex);
        }
        try {
            json.put("discoFeed", discoFeed);
//            for (int i=0;i<discoFeed.length();i++){
//                json.accumulate("discoFeed", discoFeed.get(i));
//            }
//            json.append("discoFeed", discoFeed.getJSONArray("idpList"));
        } catch (JSONException ex) {
            LOG.log(Level.INFO, null, ex);
        }
        return json;
    }