public void Pack(BinaryWriter writer)
 {
     writer.Write(RecordCount);
     writer.Write((ushort)0x000B); // Unused value
     Officers.Pack(writer);
     OfficerTitles.Pack(writer);
     writer.Write(MonarchBroadcastTime);
     writer.Write(MonarchBroadcastsToday);
     writer.Write(SpokesBroadcastTime);
     writer.Write(SpokesBroadcastsToday);
     writer.WriteString16L(Motd);
     writer.WriteString16L(MotdSetBy);
     writer.Write(ChatRoomID);
     Bindpoint.Pack(writer);
     writer.WriteString16L(AllegianceName);
     writer.Write(NameLastSetTime);
     writer.WriteBool32(IsLocked);
     writer.Write(ApprovedVassal);
     if (RecordCount > 0)
     {
         MonarchData.Pack(writer);
         for (int i = 0; i < RecordCount - 1; i++)
         {
             Records[i].Pack(writer);
         }
     }
 }
        public void Unpack(BinaryReader reader)
        {
            RecordCount = reader.ReadUInt16();
            var temp1 = reader.ReadUInt16(); // Unused value

#if NETWORKVALIDATION
            if (temp1 != 0x000B)
            {
                throw new Exception("Recieved value different from static on AllegianceHierarchy, expected: 0x000B, actual " + temp1);
            }
#endif
            Officers.Unpack(reader);
            OfficerTitles.Unpack(reader);
            MonarchBroadcastTime   = reader.ReadInt32();
            MonarchBroadcastsToday = reader.ReadUInt32();
            SpokesBroadcastTime    = reader.ReadInt32();
            SpokesBroadcastsToday  = reader.ReadUInt32();
            Motd       = reader.ReadString16L();
            MotdSetBy  = reader.ReadString16L();
            ChatRoomID = reader.ReadUInt32();
            Bindpoint.Unpack(reader);
            AllegianceName  = reader.ReadString16L();
            NameLastSetTime = reader.ReadInt32();
            IsLocked        = reader.ReadBool32();
            ApprovedVassal  = reader.ReadUInt32();
            if (RecordCount > 0)
            {
                MonarchData.Unpack(reader);
                Records.Clear();
                for (int i = 0; i < RecordCount - 1; i++)
                {
                    AllegianceNode newItem = new AllegianceNode();
                    newItem.Unpack(reader);
                    Records.Add(newItem);
                }
            }
        }