public bool UpdateSubject(Subject subject)
 {
     var existingEntry = _objectFactory.GetRepositoryInstance<Subject>().GetById(subject.Id);
     if (existingEntry == null)
         return false;
     _objectFactory.GetRepositoryInstance<Subject>().Detach(existingEntry);
     _objectFactory.GetRepositoryInstance<Subject>().Update(subject);
     try
     {
         _objectFactory.Commit();
         return true;
     }
     catch
     {
         return false;
     }
 }
 public ActionResult Create(CreateSubjectViewModel model)
 {
     if (model.Name.IsNullOrWhiteSpace())
     {
         return RedirectToAction("Index");
     }
     var subject = new Subject()
     {
         Name = model.Name,
         Alias = AliasParser.ParseToCyrillic(AliasParser.ChangeByDemand(model.Name))
     };
     try
     {
         _subjectManager.Create(subject);
     }
     catch (Exception e)
     {
         model.ErrorMessage = e.Message;
     }
     return RedirectToAction("Index");
 }
 public Guid? Create(Subject subject)
 {
     _objectFactory.GetRepositoryInstance<Subject>().Add(subject);
     _objectFactory.Commit();
     return _objectFactory.GetRepositoryInstance<Subject>().Find(x => x.Id == subject.Id).FirstOrDefault().Id;
 }