private void CheckGroup(Chat chat)
        {
            LayoutName = null;
            if (chat != null)
            {
                User user = (Session.Contains("User")) ? (User) Session["User"] : null;
                if (user != null)
                {
                    bool userbelongstogroup = false;
                    if (((bool)Session["isAdmin"]) || ((bool)Session["isRoot"]))
                        userbelongstogroup = true;
                    foreach (Group g in user.Groups)
                    {
                        if (g.Id == chat.OGroup.Id)
                            userbelongstogroup = true;
                    }

                    if (userbelongstogroup == false)
                        throw new Unauthorized();
                }
                else
                    throw new Unauthorized();
            }
            else
                throw new Unauthorized();
        }
 public void New()
 {
     CheckSuperUser();
     PropertyBag["groups"] = Group.FindAll();
     PropertyBag["chat"] = new Chat();
 }