public ActionResult AddMember(string email, int permission, int companyid)
        {
            var mgr = new AdminMembersRepository();

            Guid         g  = Guid.NewGuid();
            string       gg = g.ToString();
            Organization o  = mgr.GetOrg(companyid);
            User         u  = mgr.CheckIfUserExist(email);

            if (u == null)
            {
                mgr.AddMember(email, permission, gg, null, o.Id);
            }
            else
            {
                if (permission == 2 || permission == 3)
                {
                    bool IsAdmin = mgr.CheckIfAdminAnywhere(u);
                    if (IsAdmin)
                    {
                        TempData["error"] = "The user you invited to join the organization is an administrator elsewhere and cannot become a admin of your organization as well";
                        return(RedirectToAction("Index"));
                    }
                }
                mgr.AddAction(int.Parse(User.Identity.Name), "Received invite to join organization " + o.Name, DateTime.Now);
                mgr.AddMember(email, permission, gg, u.Id, o.Id);
            }
            var manager = new EmailManager();

            mgr.AddOrgAction(companyid, int.Parse(User.Identity.Name), "Sent invite to " + email + " to join organization", DateTime.Now);
            manager.SendInvitationMemberEmail(email, gg, o);
            return(RedirectToAction("Index"));
        }