'add m into the store, if it exists first remove it and its mappings
each man page may have aliases besides the name determined by its
basename'

def addmanpage(self, m):

    d = self.manpage.find_one({'source': m.source})
    if d:
        logger.info('removing    old    manpage    %s    (%s)', m.source, d['_id'])
        self.manpage.remove(d['_id'])
        c = self.mapping.count()
        self.mapping.remove({'dst': d['_id']})
        c -= self.mapping.count()
        logger.info('removed    %d    mappings    for    manpage    %s', c, m.source)
    o = self.manpage.insert(m.to_store())
    for (alias, score) in m.aliases:
        self.addmapping(alias, o, score)
        logger.info('inserting    mapping    (alias)    %s    ->    %s    (%s)    with    score    %d', alias, m.name, o, score)
    return m
