Moving the validation to a trait.