Replace database queries in repositories with Morphia

Needs license