* @return tag
*/
public static Tag getTag(String name, String userId, String hostId) throws Exception {
// validating if exists a tag with the name provided
HibernateUtil dh = new HibernateUtil(List.class);
dh.setQuery("from tag in class com.dotmarketing.tag.model.Tag where lower(tagName) = ?");
dh.setParam(name.toLowerCase());
Tag newTag = new Tag();
List<Tag> tags = (List<Tag>) dh.list();
// if doesn't exists then the tag is created
if (tags == null || tags.size() == 0) {
// creating tag
return saveTag(name, userId, hostId);
}