for (Genre g : genres) {
if (g.getName().equalsIgnoreCase(genre)) {
return g; // already contained
}
}
Genre g = new GenreHibernateImpl(genre);
List l = genres; // old trick, we know Genre is a repo object
InsertionSort.insert((List<RepositoryObjectHibernateImpl>)l, (RepositoryObjectHibernateImpl) g);
save(g);
return g;
}