Updated MAM for MUC: async writer, distributed generation of UIDs for messages. Moved some general code into mod_mam_utils.