Moving validation code duplication into trait