Added virtual method OnViewModelChanged and event handler code when the model is changed