Removing the duplication of the validation.