private async void OnSelectedQueryChanged()
        {
            if (CollectionViewModel != null)
            {
                await CollectionViewModel.CloseViewModelAsync(null).ConfigureAwait(true);
            }

            CollectionViewModel =
                TypeFactory.Default.CreateInstanceWithParametersAndAutoCompletion(
                    typeof(CollectionDataGridViewModel), SelectedQuery) as
                CollectionDataGridViewModel;
        }
 /// <summary>
 /// Closes this instance. Always called after the <see cref="M:Catel.MVVM.ViewModelBase.Cancel" /> of <see cref="M:Catel.MVVM.ViewModelBase.Save" /> method.
 /// </summary>
 /// <returns></returns>
 protected override Task CloseAsync()
 {
     return(CollectionViewModel.CloseViewModelAsync(null));
 }