Better error handling in ResourceViewModel.cs