private void InsertOne(BlogGroup newObject)
        {
            if (newObject == null)
            {
                return;
            }
            if (CategoryCollection == null)
            {
                return;
            }

            // Use InsertOneAsync for single BsonDocument insertion.
            //classCollection.InsertMany(school.ListClass);

            GroupCollection.InsertOne(newObject);
        }
        public short CreateNewBlogGroup(ObjectId categoryId, ref short errorCode)
        {
            BlogGroup newObject = new BlogGroup();
            var       category  = CategoryCollection.Find(c => c._id == categoryId).FirstOrDefault();

            if (category != null)
            {
                InsertOne(newObject);
                if (category.Groups == null)
                {
                    category.Groups = new ObservableCollection <ObjectId>();
                }
                category.Groups.Add(newObject._id);
                // build the query to update
                var updateDef = Builders <Category> .Update.Set(o => o.Groups, category.Groups);

                // Update
                CategoryCollection.UpdateOne(c => c._id == categoryId, updateDef);
            }

            return(newObject._id.Pid);
        }