public ActionResult LoadArticle(ContentModelLoad model)
        {
            ContentModel modelo = new ContentModel();
            List<CategoryModel> cateList = new List<CategoryModel>();
            foreach (var item in model.CategoriesId)
            {
                cateList.Add(catRepository.Get(item));
            }
            modelo.Comments = new List<CommentModel>();
            modelo.Categories = cateList;
            modelo.Content = model.Content;
            modelo.DatePosted = DateTime.Now;
            modelo.IsActive = model.IsActive;
            modelo.IsFeatured = model.IsFeatured;
            modelo.IsImportant = model.IsImportant;
            modelo.Resume = model.Resume;
            modelo.Title = model.Title;
            UserModel us = userRepository.GetByMail(model.UserMail);
            if (us == null)
            {
                us = new UserModel();
                us.FirstDateOn = DateTime.Now;
                us.LastDateOn = DateTime.Now;
                us.UserMail = model.UserMail;
                us.UserName = model.UserName;
                // userRepository.Save(us);
            }
            modelo.User = us;
            repository.SaveContent(modelo);

            return View ("LoadImages", modelo.Id);
        }
 public void SaveContent(ContentModel model)
 {
     foreach (var item in model.Categories)
     {
         dbContext.Categories.Attach(item);
     }
     dbContext.Users.Attach(model.User);
     dbContext.Contents.Add(model);
     dbContext.SaveChanges();
 }