docs: function archiveResource(resource, primary, archive) {
          if (!resource.archive) { return true; }
  
          var name = resource.name;
  
          primary.bind(name);
          archive.bind(name);
  
          // get the archive criteria
          var criteria = resource.archive();
  
          log.info('Getting archive docs for ' + name);
  
          // find all the documents that match the archive criteria
          return getDocsToArchive(criteria, primary[name])
              .then(function (docs) {
  
                  log.info('Found ' + docs.length + ' ' + name + ' docs to archive');
  
                  // insert all of the documents into the archive database
                  var deferred = Q.defer();
                  archive[name].insert(docs, function (err, results) {
                      err ? deferred.reject(err) : deferred.resolve(results);
                  });
                  return deferred.promise;
              })
              .then(function () {
  
                  log.info('Docs inserted into archive DB for ' + name + '. Now deleting docs in main db');
  
                  // delete the data from the primary database
                  var deferred = Q.defer();
                  primary[name].remove(criteria, function (err, results) {
  
                      log.info('Deleting docs complete for ' + name);
  
                      err ? deferred.reject(err) : deferred.resolve(results);
                  });
                  return deferred.promise;
  
              });
      }