private bool CanCloseViewModel(IViewModel viewModel, object parameter) { IDataContext context; if (!viewModel.Settings.Metadata.TryGetData(CloseContextConstant, out context)) { context = new DataContext { { NavigationConstants.ViewModel, viewModel } }; viewModel.Settings.Metadata.AddOrUpdate(CloseContextConstant, context); } if (parameter != null) { context.AddOrUpdate(NavigationConstants.CloseParameter, parameter); } return(NavigationService.CanClose(context)); }