Moved code to MainWindowViewModel