public int FindMissingRevisions(RevisionList revs)
        {
            var sortedRevs = new RevisionList(revs);
            sortedRevs.SortByDocID();
            var lastDocId = (string)null;
            var doc = (C4Document*)null;
            var removedCount = 0;
            try {
                foreach(var rev in sortedRevs) {
                    if(rev.DocID != lastDocId) {
                        lastDocId = rev.DocID;
                        Native.c4doc_free(doc);
                        doc = Native.c4doc_get(Forest, lastDocId, true, null);
                    }

                    if(doc == null) {
                        continue;
                    }

                    rev.RevID.PinAndUse(slice =>
                    {
                        if(Native.c4doc_selectRevision(doc, slice, false, null)) {
                            while (revs.Contains (rev)) {
                                removedCount++;
                                revs.Remove (rev);
                            }
                        }
                    });
                }
            } finally {
                Native.c4doc_free(doc);
            }

            return removedCount;
        }