Best way to implement createdBy and updatedBy fields

On some collections, I need to keep the creator and the last modifier of objects.
To do this, I add 2 fields, createdBy and updatedBy that are pointers to the _User class. Then I implement de beforeSave trigger to fill theses two fields.

Off course it works well. But as the number of collection increases, the boilerplate due to this mecanic grows as well. So I’m wondering if someone know a better way to this.

I’m a bit surprised to not find any topic about this. It seems to me that it is a rather banal functionality which could deserve a PR. What do you think ?

Thx all…