internal static void Serialize(BinaryWriter bw, PartitionedBloomState state)
        {
            bw.Write(state.M);
            bw.Write(state.K);
            bw.Write(state.S);
            bw.Write(state.Count);

            bw.Write(state.Buckets.Length);
            foreach (var bucket in state.Buckets)
            {
                BucketSerializer.Serialize(bw, bucket);
            }
        }
        internal static PartitionedBloomState Deserialize(BinaryReader br)
        {
            uint m     = br.ReadUInt32();
            uint k     = br.ReadUInt32();
            uint s     = br.ReadUInt32();
            uint count = br.ReadUInt32();

            int buckets = br.ReadInt32();
            var stored  = new List <BucketState>();

            for (var i = 0; i < buckets; i++)
            {
                stored.Add(BucketSerializer.Deserialize(br));
            }

            return(new PartitionedBloomState
            {
                Buckets = stored.ToArray(),
                M = m,
                K = k,
                S = s,
                Count = count
            });
        }