How to write an M2M2 module