check uniqueness before trying to save data