public JsonResult RemoveDomain(int[] RemoveDomains)
        {
            DomainListModel _model = new DomainListModel();
            List<Domain> _deleted = new List<Domain>();

            foreach (int DomainID in RemoveDomains)
            {
                Domain domain = Web.Admin.Logic.Collections.Domains.GetBy(DomainID);
                List<ProfileField> _profileFields = ProfileFields.GetByDomain(DomainID);

                if (ProfileFields.GetByDomain(domain.DomainID).Count > 0)
                {
                    domain.WasDeleted = false;
                    domain.UIMessage = "The domain has not been deleted. Attached fields: ";
                    foreach (ProfileField profileField in _profileFields)
                    {
                        domain.UIMessage += "<u>" + profileField.FieldName + "</u>&nbsp;";
                    }
                                        domain.UIMessageType = UIMessageType.Warning;
                    AuditEvent.AppEventSuccess(Profile.Member.Email, String.Format(AuditEvent.RoleContainsMembers, domain.Name));
                }
                else
                {
                    if (domain.Delete())
                    {
                        domain.WasDeleted = true;
                        domain.UIMessage = "The domain has been deleted.";
                        domain.UIMessageType = UIMessageType.Success;
                        AuditEvent.AppEventSuccess(Profile.Member.Email, String.Format(AuditEvent.RoleDeleted, domain.Name));
                    }
                }

                _deleted.Add(domain);
            }

            _model.Domains = _deleted;

            return Json(new
            {
                NotifyType = NotifyType.Dialog,
                Html = this.RenderPartialView(@"_RemoveDomainsResult", _model)

            }, JsonRequestBehavior.AllowGet);
        }
        public JsonResult GetRemoveDomainDialog(int[] RmoveDomains)
        {
            DomainListModel _model = new DomainListModel();
            foreach (int DomainID in RmoveDomains)
            {
                Domain domain = Web.Admin.Logic.Collections.Domains.GetBy(DomainID);
                _model.Domains.Add(domain);
            }

            return Json(new
            {
                Html = this.RenderPartialView(@"_RemoveDomains", _model),

            }, JsonRequestBehavior.AllowGet);
        }