public ActionResult Add(Problem newProblem, FormCollection form) { ProblemModel pm = new ProblemModel(); if (ModelState.IsValid) { newProblem.AuthorID = (int)Session["UserID"]; newProblem.Points = 1; newProblem.IsSolved = false; var AllStrings = form["checkboxTag"].Split(','); foreach (string item in AllStrings) { int value = int.Parse(item); var tag = _tagRepo.GetTagById(value); newProblem.Tags.Add(tag); } pm.AddProblem(newProblem); return(RedirectToAction("Index")); } else { return(RedirectToAction("Index")); } }