Extract common functionality to xblock-utils

@dragonfi I'll leave it up to you and @e-kolpakov -- I personally prefer the nomenclature I gave above, which I think is clearer/cleaner, but I'm fine with anything you decide is good.