public void AddPart(string key, Part part, bool asMainPart)
        {
            if (_parts.ContainsKey(key))
            {
                Part existingPart = (Part)_parts[key];

                if (existingPart == part)
                {
                    part = (Part)_parts[key];
                }
                else
                {
                    existingPart.DisableRelatedControllers();
                    _parts[key] = part;
                }
            }
            else
            {
                _parts.Add(key, part);
            }

            if (asMainPart)
            {
                _mainPart = part;
            }
        }
        private object GetRelatedPartKey(Part part)
        {
            if (_parts.ContainsValue(part))
            {
                IDictionaryEnumerator enumerator = _parts.GetEnumerator();
                Part tempPart;

                while (enumerator.MoveNext())
                {
                    tempPart = (Part)enumerator.Value;

                    if (tempPart == part)
                    {
                        return enumerator.Key;
                    }
                }
            }

            return null;
        }
        public void RemovePart(Part part)
        {
            if (_parts.ContainsValue(part))
            {
                part.DisableRelatedControllers();

                object key = GetRelatedPartKey(part);
                if (key != null)
                {
                    _parts.Remove(key);
                }
            }
        }