Move function to other module to reduce diff with core

Actually doesn't reduce the diff, but since that function is only used
in that module that was dropped in core it makes sense to have it there
in order to have less files with differences.
Changes to reduce the diff with core

This makes easier to spot the differences in models so we can
move towards core.