public ActionResult Add(AddDelegationModel model)
        {
            if (!ModelState.IsValid)
            {
                return View();
            }

            var setting = new DelegationModel
            {
                UserName = model.UserName,
                Realm = new Uri(model.Realm),
                Description = model.Description
            };

            try
            {
                _repository.Add(setting);
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.InnerException.Message);
                return View("Add");
            }

            return RedirectToAction("Index");
        }
        public void Add(DelegationModel model)
        {
            var doc = new Delegation
            {
                UserName = model.UserName,
                Realm = model.Realm.AbsoluteUri,
                Description = model.Description
            };

            _session.Store(doc);
        }
 public void Delete(DelegationModel model)
 {
     var doc = _session.Load<Delegation>(model.Id);
     _session.Delete(doc);
 }