encapsulate the dismissing keyboard method into a class.