modified validation to handle compound unique indexes

previous implementation only worked on single field unique indexes