public ActionResult Edit(int?id)
 {
     try
     {
         StudentGroup model;
         if (id != null)
         {
             using (DataContext ctx = new DataContext())
             {
                 model = ctx.StudentGroup.First(t => t.Id == id);
             }
         }
         else
         {
             model = new StudentGroup();
             model.InitNewObject();
         }
         return(View("Edit", model));
     }
     catch (Exception ex)
     {
         ViewBag.Message = ex.Message;
         return(Index());
     }
 }