added groups repository, improved db and model