Extract common functionality to xblock-utils

This is what I came up with. You could just use a class-attribute instead of a property here, it would work regardless.