Move template generation related methods in a mixin