 
         let folder = BookmarkFolder(guid: guid, title: title)
         folder.id = id
+        BookmarkFactory.addIcon(folder, row: row)
         return folder
-    }
-
-    private class func nodeFactory(row: SDRow) -> BookmarkNode {
-        let guid = row["guid"] as! String
-        let title = row["title"] as? String ?? SQLiteBookmarks.defaultItemTitle
-        return BookmarkNode(guid: guid, title: title)
     }
 
     class func factory(row: SDRow) -> BookmarkNode {

                    args.append(icon)
                }

                let sql = "INSERT INTO \(TableBookmarks) (guid, type, url, title, parent, faviconID) VALUES (?, ?, ?, ?, ?, \(iconValue))"
                err = conn.executeChange(sql, withArgs: args)
                if let err = err {
                    log.error("Error inserting \(urlString). Got \(err).")
                    return deferMaybe(DatabaseError(err: err))
                }
                return succeed()
            }


// TODO: also search mirrored bookmarks.
extension SQLiteBookmarks: SearchableBookmarks {
    public func bookmarksByURL(url: NSURL) -> Deferred<Maybe<Cursor<BookmarkItem>>> {
        let inner = "SELECT id, type, guid, bmkUri, title, faviconID FROM \(TableBookmarksLocal) WHERE type = \(BookmarkNodeType.Bookmark.rawValue) AND bmkUri = ?"
        let sql =
        "SELECT bookmarks.id AS id, bookmarks.type AS type, guid, bookmarks.bmkUri AS bmkUri, title, " +
        "favicons.url AS iconURL, favicons.date AS iconDate, favicons.type AS iconType " +
        "FROM (\(inner)) AS bookmarks " +
        "LEFT OUTER JOIN favicons ON bookmarks.faviconID = favicons.id"
        let args: Args = [url.absoluteString]
        return db.runQuery(sql, args: args, factory: BookmarkFactory.itemFactory)
    }
}

