The class is somewhat like a module in this context...
But still best to include the whole lot inside your own module...
Can I suggest you revisit your various entities definitions.
Sometimes you use model.active_entities, another model.entities, they might not always be the same thing...
Also if you make your group and immediately add thing to group.entities it might be easier...