This seems generic enough it ought to be in the BaseWidget class.