private bool remove(TKey key, [MaybeNullWhen(false)] out TValue value, BindableDictionary <TKey, TValue>?caller)
        {
            ensureMutationAllowed();

            if (!collection.Remove(key, out value))
            {
                return(false);
            }

            if (bindings != null)
            {
                foreach (var b in bindings)
                {
                    // prevent re-removing from the callee.
                    // That would result in a <see cref="StackOverflowException"/>.
                    if (b != caller)
                    {
                        b.remove(key, out _, this);
                    }
                }
            }

            notifyDictionaryChanged(new NotifyDictionaryChangedEventArgs <TKey, TValue>(NotifyDictionaryChangedAction.Remove, new KeyValuePair <TKey, TValue>(key, value)));

            return(true);
        }
        private void add(TKey key, TValue value, BindableDictionary <TKey, TValue>?caller)
        {
            ensureMutationAllowed();

            collection.Add(key, value);

            if (bindings != null)
            {
                foreach (var b in bindings)
                {
                    // prevent re-adding the item back to the callee.
                    // That would result in a <see cref="StackOverflowException"/>.
                    if (b != caller)
                    {
                        b.add(key, value, this);
                    }
                }
            }

            notifyDictionaryChanged(new NotifyDictionaryChangedEventArgs <TKey, TValue>(NotifyDictionaryChangedAction.Add, new KeyValuePair <TKey, TValue>(key, value)));
        }