public UUID CreateGroup(UUID RequestingAgentID, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment,
                         bool allowPublish, bool maturePublish, UUID founderID, out string reason)
 {
     m_log.DebugFormat("[Groups]: Creating group {0}", name);
     reason = string.Empty;
     return(m_GroupsService.CreateGroup(RequestingAgentID.ToString(), name, charter, showInList, insigniaID,
                                        membershipFee, openEnrollment, allowPublish, maturePublish, founderID, out reason));
 }
        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));
        }