move error handling to viewmodel