make the validate_uniqueness custom validation function more generic