refactored repository handler into a generic base handler and used it in the viewmodel handler aswell, added tests