I think this should be part of a library ... I proposed something last year: https://github.com/dantleech/cmf-standard-lib