validate and test uniqueness