public override void AllocateUndecidedKeys(KeyAllocation keyAllocation)
        {
            base.AllocateUndecidedKeys(keyAllocation);

            foreach (var allocation in keyAllocation.Allocation)
            {
                if (!ApplicationKeyBuffers.ContainsKey(allocation.Key))
                {
                    AddKeyBuffer(allocation.Key, allocation.Value);
                }
            }

            var sorted          = keyAllocation.Allocation.ToList().OrderBy(s => s.Value.Priority);
            int undecidedLength = 0;

            do
            {
                undecidedLength = UndecidedKeyBuffer.GetLength();
                foreach (var allocation in sorted)
                {
                    if (allocation.Value.BPS <= UndecidedKeyBuffer.GetLength())
                    {
                        var key = UndecidedKeyBuffer.GetKey(allocation.Value.BPS);
                        ApplicationKeyBuffers[allocation.Key].AddKey(key);
                    }
                }
            } while (undecidedLength != UndecidedKeyBuffer.GetLength());
        }
        public void AddNewKey(Key newKey, KeyAllocation keyAllocation)
        {
            Key rest = newKey;

            var split1 = rest.DivideKey(ServiceKeyBuffer.GetServiceKeyLength());

            ServiceKeyBuffer.AddKey(split1.Item1);
            rest = split1.Item2;

            var split2 = rest.DivideKey(ServiceKeyBuffer.GetServiceKeyLength());

            ServiceKeyBuffer.AddKey(split2.Item1);
            rest = split2.Item2;

            UndecidedKeyBuffer.AddKey(rest);
            AllocateUndecidedKeys(keyAllocation);
        }