Separating out repository logic, tidying up viewmodel