How to handle possible name conflict if two groups have same name?

I’m working on an extension which can save a window tab and you can name the group.
So, the problem is if I save another grp and enter the same name how should i handle naming conflict. I’m looking for adding number suffix on the entered name.

The problem is at runtime i store all the data in dictionary and want to avoid any additional computation period to whole process.

So, I would appreciate any ideas on what to do.