/// <summary>
 /// Adds a new mail subscription.
 /// </summary>
 /// <param name="sub">Mail subscription.</param>
 public void saveNewMailSubscription(MailSub sub)
 {
     sub.org = this._org;
     db.MailSub.Add(sub);
     db.SaveChanges();
 }
 public ActionResult subsAdd(string userName, [Bind()] subsAddViewModel sub, int orgId)
 {
     if (!authRepo.userCanManageOrg(userName, orgId))
     {
         return RedirectToAction(actionName: "LogOn", controllerName: "Account");
     }
     repo.initialize(orgId);
     ViewBag.organizationName = repo.orgName();
     ViewBag.organizationID = orgId.ToString();
     if(ModelState.IsValid)
     {
         MailSub subObj = new MailSub();
         if (sub.subPoint)
         {
             subObj.point = repo.findPointById(sub.pointId);
         }
         if (sub.subOrg)
         {
             subObj.org = repo.org();
         }
         subObj.email = sub.Email;
         subObj.user = repo.getAllUsers().Where(n => n.name == userName).First();
         repo.saveNewMailSubscription(subObj);
         Response.RedirectToRoute(new { controller = "Dashboard", action = "subs", orgId = orgId });
     }
     return View(sub);
 }