public virtual ActionResult AddAuthorizedType(AuthorizedTypeView authorizedType)
 {
     if (ModelState.IsValid)
     {
         var newtype = new AuthorizedType();
         UpdateModel(newtype);
         Repository.Add(newtype);
         Repository.Save();
         return RedirectToAction(MVC.AppSetting.AuthorizeList());
     }
     return View(authorizedType);
 }
        private void FixupAuthorizedType(AuthorizedType previousValue)
        {
            if (previousValue != null && previousValue.PartnerCompanies.Contains(this))
            {
                previousValue.PartnerCompanies.Remove(this);
            }

            if (AuthorizedType != null)
            {
                if (!AuthorizedType.PartnerCompanies.Contains(this))
                {
                    AuthorizedType.PartnerCompanies.Add(this);
                }
                if (AuthorizedTypeId != AuthorizedType.Id)
                {
                    AuthorizedTypeId = AuthorizedType.Id;
                }
            }
            else if (!_settingFK)
            {
                AuthorizedTypeId = null;
            }
        }