I have 2 groups.I should prevent the duplicate names. Anybody can send the code?

I have 2 groups.I should prevent the duplicate names. Anybody can send the code?

  Discussion posts and replies are publicly visible