Extract validation to a single class.