             delete idMap[id]
     Q.all(insertPromises).then -> dest
 
-  # @param {Array.<Meteor.Collection>} collections
-  # @returns {Object.<String, Meteor.Collection>} A map of collection name to object for the given
-  # collections.
-  getMap: (collections) ->
-    collectionMap = {}
-    _.each collections, (collection) =>
-      name = @getName(collection)
-      collectionMap[name] = collection
-    collectionMap
-
-  # @param {Object.<String, String>} map - A map of IDs to names of the items.
-  # @returns A temporary collection with items created from the given map.
-  fromNameMap: (map, args) ->
-    args = _.extend({
-    }, args)
-    collection = Collections.createTemporary()
-    callback = args.callback
-    _.each map, (item, id) ->
-      if callback
-        name = callback(item, id)
+####################################################################################################
+# DOCS
+####################################################################################################
+
+  moveDoc: (id, sourceCollection, destCollection) ->
+    order = sourceCollection.findOne(id)
+    unless order
+      throw new Error('Could not find doc with id ' + id + ' in collection ' + sourceCollection)
+    destCollection.insert order, (err, result) ->
+      if err
+        throw new Error('Failed to insert into destination collection when moving')
       else
-        name = item
-      collection.insert(_id: id, name: name)
-    collection
-
-  # @returns {String} Generates a MongoDB ObjectID hex string.
-  generateId: -> new Mongo.ObjectID().toHexString()
+        sourceCollection.remove id, (err2, result2) ->
+          if err2
+            throw new Error('Failed to remove from source collection when moving')
+
+  duplicateDoc: (docOrId, collection) ->
+    df = Q.defer()
+    doc = if Types.isObject(docOrId) then docOrId else collection.findOne(docOrId)
+    delete doc._id
+    collection.insert doc, (err, result) -> if err then df.reject(err) else df.resolve(result)
+    df.promise
+
+  removeAllDocs: (collection) ->
+    _.each collection.find().fetch(), (order) ->
+      collection.remove(order._id)
 
   # @param {Object} doc
   # @param {Object} modifier - A MongoDB modifier object.

    else
      handle(result)

  intersection: (a, b) ->
    result = @createTemporary()
    a.find().forEach (item) ->
      if b.findOne(item._id)
        result.insert(item)
    result

global = @

Collections =

####################################################################################################
# COLLECTIONS
####################################################################################################

  allow: -> true
  allowAll: -> insert: @allow, update: @allow, remove: @allow
