                         catch e
                             cb("corrupt patches blob -- #{e}")
                             return
-                        if patches.length == 0
-                            cb()
-                            return
-                        if patches[0].id?
-                            # convert from OLD RethinkDB format!
-                            v = []
-                            for x in patches
-                                patch =
-                                    string_id : x.id[0]
-                                    time      : new Date(x.id[1])
-                                    user_id   : x.user
-                                    patch     : x.patch
-                                    snapshot  : x.snapshot
-                                    sent      : x.sent
-                                    prev      : x.prev
-                                v.push(patch)
-                            patches = v
-                        dbg("insert patches into patches table")
-                        # We break into blocks since there is limit (about 65K) on
-                        # number of params that can be inserted in a single query.
-                        insert_block_size = 1000
-                        f = (i, cb) =>
-                            @_query
-                                query    : 'INSERT INTO patches'
-                                values   : patches.slice(insert_block_size*i, insert_block_size*(i+1))
-                                conflict : 'ON CONFLICT DO NOTHING'  # in case multiple servers (or this server) are doing this unarchive at once -- this can and does happen sometimes.
-                                cb       : cb
-                        async.mapSeries([0...patches.length/insert_block_size], f, cb)
+                        @import_patches
+                            patches : patches
+                            cb      : cb
                     (cb) =>
                         async.parallel([
                             (cb) =>

                    blob = new Buffer(JSON.stringify(patches))
                catch err
                    # TODO: This *will* happen if the total length of all patches is too big.
                    cb(err)
                    return
                dbg('save blob')

                            cb()
            (cb) =>
                if last_active? and last_active >= opts.cutoff
                    dbg("excluding due to cutoff")
                    cb(); return
                dbg("get patches")
                @export_patches
                    string_id : opts.string_id
                    cb        : (err, x) =>
                        patches = x
                        cb(err)
            (cb) =>
                if last_active? and last_active >= opts.cutoff
