public ExtendedGroupRecord GetGroupRecord(string RequestingAgentID, UUID GroupID, string GroupName)
        {
            if (GroupID != UUID.Zero)
            {
                return(m_GroupsService.GetGroupRecord(RequestingAgentID, GroupID));
            }
            else if (GroupName != null)
            {
                return(m_GroupsService.GetGroupRecord(RequestingAgentID, GroupName));
            }

            return(null);
        }
        byte[] HandleAddOrUpdateGroup(Dictionary <string, object> request)
        {
            Dictionary <string, object> result = new Dictionary <string, object>();

            ExtendedGroupRecord grec = GroupsDataUtils.GroupRecord(request);

            if (!request.ContainsKey("RequestingAgentID") || !request.ContainsKey("OP"))
            {
                NullResult(result, "Bad network data");
            }

            else
            {
                string RequestingAgentID = request["RequestingAgentID"].ToString();
                string reason            = string.Empty;
                string op = request["OP"].ToString();
                if (op == "ADD")
                {
                    grec.GroupID = m_GroupsService.CreateGroup(RequestingAgentID, grec.GroupName, grec.Charter, grec.ShowInList, grec.GroupPicture, grec.MembershipFee,
                                                               grec.OpenEnrollment, grec.AllowPublish, grec.MaturePublish, grec.FounderID, out reason);
                }
                else if (op == "UPDATE")
                {
                    m_GroupsService.UpdateGroup(RequestingAgentID, grec.GroupID, grec.Charter, grec.ShowInList, grec.GroupPicture, grec.MembershipFee,
                                                grec.OpenEnrollment, grec.AllowPublish, grec.MaturePublish);
                }

                if (grec.GroupID != UUID.Zero)
                {
                    grec = m_GroupsService.GetGroupRecord(RequestingAgentID, grec.GroupID);
                    if (grec == null)
                    {
                        NullResult(result, "Internal Error");
                    }
                    else
                    {
                        result["RESULT"] = GroupsDataUtils.GroupRecord(grec);
                    }
                }
                else
                {
                    NullResult(result, reason);
                }
            }

            string xmlString = ServerUtils.BuildXmlResponse(result);

            //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
            return(Util.UTF8NoBomEncoding.GetBytes(xmlString));
        }