public ActionResult RemoveAlias(FormCollection _POST)
        {
            try
            {
                CustomAlias removeAlias = new CustomAlias()
                {
                    Organization      = _POST["organization"],
                    UserPrincipalName = _POST["userprincipalname"],
                    EmailAddresses    = _POST["emailaddresses"].Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries).ToList <string>()
                };
                for (int i = 0; i < removeAlias.EmailAddresses.Count; i++)
                {
                    removeAlias.EmailAddresses[i] = removeAlias.EmailAddresses[i].Trim();
                }

                if (removeAlias.EmailAddresses.Count == 0)
                {
                    throw new Exception("No aliases specified");
                }

                model.Alias = removeAlias;

                CommonCAS.Log(string.Format("has run Mail/RemoveAlias() for user {0} to remove alias {1}", removeAlias.UserPrincipalName, string.Join(", ", removeAlias.EmailAddresses)));

                // execute powershell script and dispose powershell object
                using (MyPowerShell ps = new MyPowerShell())
                {
                    ps.RemoveAlias(removeAlias);
                    var result = ps.Invoke();
                }

                CommonCAS.Stats("Mail/RemoveAlias");

                model.OKMessage.Add("Succesfully removed alias for " + removeAlias.UserPrincipalName);
                foreach (string alias in removeAlias.EmailAddresses)
                {
                    model.OKMessage.Add(alias);
                }

                return(View("RemoveAlias", model));
            }
            catch (Exception exc)
            {
                CommonCAS.Log("Exception: " + exc.Message);
                model.ActionFailed = true;
                model.Message      = exc.Message;
                return(View(model));
            }
        }