Replace database queries in repositories with Morphia

General comment now, it seems like there is a mix in these files of indentation style.