           for collection in Zotero.getCollections()
             @collection(collection)
 
-          for group in Zotero.Groups.getAll()
-            @group(group)
-
-          # TODO: add saved searches
+          for search in Zotero.Searches.getAll()
+            @search(search)
+
+          @group()
+
           return)
 
         sendResponseCallback(200, "application/atom+xml", feed.serialize())

      supportedMethods: ["GET"]
      init: (url, data, sendResponseCallback) ->
        item = Zotero.Items.getByLibraryAndKey(url.query.library, url.query.key)
        Zotero.OPDS.log('Getting binary')
        body = Zotero.File.getBinaryContents(item.getFile())
        Zotero.OPDS.log('Got it')
        sendResponseCallback(200, item.attachmentMIMEType || 'application/pdf', body)
        Zotero.OPDS.log('Sent it')
        return

    group:
      supportedMethods: ["GET"]
      init: (url, data, sendResponseCallback) ->
        group = Zotero.Groups.getByLibraryID(url.query.id)
        updated = Zotero.DB.valueQuery(Zotero.OPDS.sql.group, url.query.id)

        feed = new Zotero.OPDS.Feed("/opds/group?id=#{url.query.id}", "Group: #{group.name}", updated, ->
          for collection in group.getCollections() || []
            @collection(collection)

          for item in (new Zotero.ItemGroup('group', group)).getItems() || []
            @item(item)

          return)

        sendResponseCallback(200, "application/atom+xml", feed.serialize())
        return

    return

  group: (group) ->
    if group
      updated = Zotero.DB.valueQuery(Zotero.OPDS.sql.group, group.id)
      libraryID = Zotero.Groups.getLibraryIDFromGroupID(group.id)
      name = group.name
    else
      updated = Zotero.DB.valueQuery(Zotero.OPDS.sql.index)
      libraryID = ''
      name = 'Group Libraries'
    @add(entry: ->
      url = "/opds/group?id=#{libraryID}"
      @add(title: name)
      @add(link: { rel: 'subsection', href: url, type: 'application/atom+xml;profile=opds-catalog;kind=acquisition' })
      @add(updated: @date(updated))
      @add(id: url)
      @add(content: { type: 'text', '': name })
      return)
    return

