Extract XBlock handler machinery into separate baseclass

[PLAT-212]