public LearningObject()
 {
     Id = new ObjectId();
     Title = "Default title";
     AuthorEmail = "default user email";
     Subject = "subject";
     Description = "default description";
     Type = LoType.None;
     Source = "default source value";
     Audience = "default audiance";
     Language = "default language";
     Outcomes = new List<Competence>();
     Prerequisites = new List<Competence>();
     CreationTime = DateTime.Now;
     LastModifiedTime = DateTime.Now;
     Domain = new Domain();
 }
        public ActionResult AddNewDomain(string parentId, string title)
        {
            ObjectId id;
            ObjectId.TryParse(parentId, out id);

            if (!title.Trim().IsEmpty())
            {
                var currentDomain = _dbContext.DomainsCollection.Find(x => x.Id == id).SingleOrDefaultAsync().Result;
                ViewBag.GrandParentId = currentDomain!=null?currentDomain.ParentId : ObjectId.Empty;
                ViewBag.ParentId = id;

                Domain newDomain = new Domain(title, id);
                _dbContext.DomainsCollection.InsertOneAsync(newDomain);

                var domList = _dbContext.DomainsCollection.Find(x => x.ParentId == id).ToListAsync().Result;
                return PartialView("EditDomainsTablePartial", domList);
            }

            ViewBag.GrandParentId = id;
            ViewBag.ParentId = id;

            List<Domain> domainsList = _dbContext.DomainsCollection.Find(x => x.ParentId == id).SortBy(x => x.Title).ToListAsync().Result;
            return PartialView("EditDomainsTablePartial", domainsList);
        }