public ActionResult Create(PresentationModel presentation)
 {
     if (Request.IsAuthenticated)
     {
         var existPresentation = CopyPresentation(presentation);
         if (ModelState.IsValid)
         {
             repository.UpdatePresentation(existPresentation);
             repository.Save();
             return RedirectToAction("Index");
         }
     }
     return RedirectToAction("Index");
 }
 //
 // GET: /Presentation/Create
 public ActionResult Create(int? id)
 {
     if (Request.IsAuthenticated)
     {
         if (!id.HasValue)
         {
             var model = new PresentationModel();
             model.UserId = repository.GetUserGUID(User.Identity.Name);
             repository.InsertPresentation(model);
             repository.Save();
             return Redirect("CreateSlides?id=" + model.PresentationId);
         }
         else
             return View();
     }
     else
     {
         return RedirectToAction("Index");
     }
 }
 private void ParseTags(PresentationModel presentation)
 {
     var tags = presentation.Tags.Split(',');
     int tagId;
     if (tags != null)
     {
         for (int i = 0; i < tags.Length; ++i)
         {
             if (!IsTagExist(tags[i], out tagId))
                 AddNewTag(tags[i], out tagId);
             InsertTag(i, tagId, presentation);
         }
     }
 }
 private void InsertTag(int tagNumber, int tagId, PresentationModel presentation)
 {
     if (tagId > 0)
     {
         switch (tagNumber)
         {
             case 0: presentation.Tag1 = tagId; break;
             case 1: presentation.Tag2 = tagId; break;
             case 2: presentation.Tag3 = tagId; break;
             case 3: presentation.Tag4 = tagId; break;
             case 4: presentation.Tag5 = tagId; break;
         }
     }
 }
 private PresentationModel CopyPresentation(PresentationModel source)
 {
     int id = source.PresentationId;
     var presentation = repository.GetPresentation(id);
     presentation.Name = source.Name;
     presentation.Description = source.Description;
     presentation.Tags = source.Tags;
     return presentation;
 }
 public ActionResult Edit(PresentationModel presentation)
 {
     if (Request.IsAuthenticated)
     {
         presentation.UserId = repository.GetUserGUID(User.Identity.Name);
         if (ModelState.IsValid)
         {
             repository.UpdatePresentation(presentation);
             repository.Save();
             return RedirectToAction("Index");
         }
     }
     return View(presentation);
 }