Change the POST and PUT handler for tags

Add some validator for POST and PUT handler.

When add a new tag (POST), handler will check if the tag name is exist
or not, if the tag name exist, function getUniqueName will give a new
tag name with "copy(d)" for the new tag.

When edit a exist tag, handler will check if changing to a name that
already exist.