anchor.diff:          }
         }
         else if (record["action"] == "remove") {
  -        logger.info("ACTION REMOVE");
           if (beforeLeqPivot(record)) {
             collectionLength--;
             diff.add(remove(record));
  
positive.code:     });
    }
  
  
  //  Future addAll(List<Map> data, String author) {
  //    num nextVersion;
  //    return _get_locks().then((_) => _maxVersion).then((version) {
  //        nextVersion = version + 1;
  //        data.forEach((elem) => elem[VERSION_FIELD_NAME] = nextVersion++);
  //        return collection.insertAll(data);
  //      }).then((_) =>
  //        _collectionHistory.insertAll(data.map((elem) =>
  //            {
  //              "before" : {},
  //              "after" : elem,
  //              "action" : "add",
  //              "author" : author,
  //              "version" : elem[VERSION_FIELD_NAME],
  //            }).toList(growable: false)),
  //      onError: (e,s) {
  //        // Errors thrown by MongoDatabase are Map objects with fields err, code,
  //        // ...
  //        return _release_locks().then((_) {
  //          throw new MongoException(e,s);
  //        });
  //      }
  //      ).then((_) => _release_locks()).then((_) => nextVersion);
  //  }
  
  //  Future deprecatedChange(String _id, Map change, String author) {
  //    num nextVersion;
  //    Map newRecord;
  //    return _get_locks().then((_) => collection.findOne({"_id" : _id}))
  //      .then((Map record) {
  //        if(record == null) {
  //          throw new MongoException(null,null,
  //              'Change was not applied, document with id $_id does not exist.');
  //        } else if (change.containsKey('_id') && change['_id'] != _id) {
  //          throw new MongoException(null,null,
  //              'New document id ${change['_id']} should be same as old one $_id.');
  //        } else {
  //          return _maxVersion.then((version) {
  //            nextVersion = version + 1;
  //            newRecord = new Map.from(record);
  //            newRecord.addAll(change);
  //            newRecord[VERSION_FIELD_NAME] = nextVersion;
  //            return collection.save(newRecord);
  //          }).then((_) =>
  //            _collectionHistory.insert({
  //              "before" : record,
  //              "after" : newRecord,
  //              "action" : "change",
  //              "author" : author,
  //              "version" : nextVersion
  //            }));
  //        }
  //      },
  //      onError: (e, s) {
  //        // Errors thrown by MongoDatabase are Map objects with fields err, code,
  //        // ...
  //        return _release_locks().then((_) {
  //          throw new MongoException(e, s);
  //        });
  //      }
  //      ).then((_) => _release_locks()).then((_) => nextVersion);
  //  }
  
    Future writeOperation(String _id, String author, String action, Map newData) {
      num nextVersion;
      return _get_locks()
  //      .then((_){
  //          if (clientVersion != null) {
  //            return _clientVersionExists(clientVersion).then((exists) {
  //              if (exists) throw true;
  //            });
  //          }
  //      })
        .then((_) => collection.findOne({"_id" : _id}))
        .then((Map oldData) {
  
  
negative.code:   Future remove(String _id, String author) {
      return writeOperation(_id, author, 'remove', {});
    }
  
    Future<Map> diffFromVersion(num version, {Map highestElement: null, num collectionLength : 0}) {
      return _maxVersion.then((maxVer) {
  