protected void ChangeItemKey(T item, string newKey) { if (!this.ContainsItem(item)) { throw Failure.CollectionElementMissing("item"); } string keyForItem = GetNameForItem(item); if (!CompareNames(keyForItem, newKey)) { if (newKey != null) { this.AddKey(newKey, item); } if (keyForItem != null) { this.RemoveKey(keyForItem); } } }