private async void InnerCreateNewCollection(NotificationMessage <CreateCollectionViewModel> message)
        {
            if (message.Notification == Constants.CreateCollectionMessage && message.Target == this)
            {
                try
                {
                    _collections.IsBusy = true;
                    MongoDB.Driver.CreateCollectionOptions options = new MongoDB.Driver.CreateCollectionOptions();
                    options.AutoIndexId      = message.Content.AutoIndexId;
                    options.Capped           = message.Content.Capped;
                    options.MaxDocuments     = message.Content.MaxDocuments;
                    options.MaxSize          = message.Content.MaxSize;
                    options.UsePowerOf2Sizes = message.Content.UsePowerOf2Sizes;
                    if (!string.IsNullOrWhiteSpace(message.Content.StorageEngine))
                    {
                        options.StorageEngine = BsonDocument.Parse(message.Content.StorageEngine);
                    }
                    await Server.MongoDbService.CreateCollectionAsync(Name, message.Content.Name, options);

                    var newCollection = new MongoDbCollectionViewModel(this, message.Content.Name);
                    newCollection.IsSelected     = true;
                    newCollection.IsBusy         = true;
                    this.IsExpanded              = true;
                    this._collections.IsExpanded = true;
                    DispatcherHelper.CheckBeginInvokeOnUI(() =>
                    {
                        _collections.Children.Add(newCollection);
                        _collections.ItemsCount = _collections.Children.OfType <MongoDbCollectionViewModel>().Count();
                    });
                    await LoadCollectionStats(newCollection);
                }
                catch (Exception ex)
                {
                    Utils.LoggerHelper.Logger.Error(string.Format("Failed to create collection '{0}' on database '{1}', server '{2}'", message.Content.Name, Name, Server.Name), ex);
                }
                finally
                {
                    _collections.IsBusy = false;
                }
            }
        }
        private async void InnerCreateNewCollection(NotificationMessage<CreateCollectionViewModel> message)
        {
            if (message.Notification == Constants.CreateCollectionMessage && message.Target == this)
            {
                try
                {
                    _collections.IsBusy = true;
                    MongoDB.Driver.CreateCollectionOptions options = new MongoDB.Driver.CreateCollectionOptions();
                    options.AutoIndexId = message.Content.AutoIndexId;
                    options.Capped = message.Content.Capped;
                    options.MaxDocuments = message.Content.MaxDocuments;
                    options.MaxSize = message.Content.MaxSize;
                    options.UsePowerOf2Sizes = message.Content.UsePowerOf2Sizes;
                    if (!string.IsNullOrWhiteSpace(message.Content.StorageEngine))
                        options.StorageEngine = BsonDocument.Parse(message.Content.StorageEngine);
                    await Server.MongoDbService.CreateCollectionAsync(Name, message.Content.Name, options);

                    var newCollection = new MongoDbCollectionViewModel(this, message.Content.Name);
                    newCollection.IsSelected = true;
                    newCollection.IsBusy = true;
                    this.IsExpanded = true;
                    this._collections.IsExpanded = true;
                    DispatcherHelper.CheckBeginInvokeOnUI(() =>
                    {
                        _collections.Children.Add(newCollection);
                        _collections.ItemsCount = _collections.Children.OfType<MongoDbCollectionViewModel>().Count();
                    });
                    await LoadCollectionStats(newCollection);
                }
                catch (Exception ex)
                {
                    Utils.LoggerHelper.Logger.Error(string.Format("Failed to create collection '{0}' on database '{1}', server '{2}'", message.Content.Name, Name, Server.Name), ex);
                }
                finally
                {
                    _collections.IsBusy = false;
                }
            }
        }