uniquifyName

Checks if the given name exists and if so prepends an increasing number to it to make it unique. If the given name already ends with a number, the number is replaced.