/// <summary>
        ///     Add a single object to the collection also adding additional configuration.
        /// </summary>
        /// <param name="namespace">is the object's namespace</param>
        /// <param name="name">is the object's name</param>
        /// <param name="clazz">is the class the object resolves to</param>
        /// <param name="type">is the object type</param>
        /// <param name="configuration">config</param>
        public void AddObject(
            string @namespace,
            string name,
            Type clazz,
            PluggableObjectType type,
            object configuration)
        {
            SerializableExtensions.EnsureSerializable(configuration);

            var namespaceMap = Pluggables.Get(@namespace);
            if (namespaceMap == null) {
                namespaceMap = new Dictionary<string, Pair<Type, PluggableObjectEntry>>();
                Pluggables.Put(@namespace, namespaceMap);
            }

            namespaceMap.Put(
                name,
                new Pair<Type, PluggableObjectEntry>(clazz, new PluggableObjectEntry(type, configuration)));
        }
        private void HandleAddPluggableObject(
            string factoryClassName,
            string @namespace,
            string name,
            PluggableObjectType type,
            object optionalCustomConfig,
            ImportServiceCompileTime importService)
        {
            SerializableExtensions.EnsureSerializable(optionalCustomConfig);

            if (factoryClassName == null) {
                throw new ConfigurationException("Factory class name has not been supplied for object '" + name + "'");
            }

            if (@namespace == null) {
                throw new ConfigurationException("Namespace name has not been supplied for object '" + name + "'");
            }

            if (name == null) {
                throw new ConfigurationException(
                    "Name has not been supplied for object in namespace '" + @namespace + "'");
            }

            Type clazz;
            try {
                clazz = importService.ClassForNameProvider.ClassForName(factoryClassName);
            }
            catch (TypeLoadException) {
                throw new ConfigurationException("View factory class " + factoryClassName + " could not be loaded");
            }

            var namespaceMap = Pluggables.Get(@namespace);
            if (namespaceMap == null) {
                namespaceMap = new Dictionary<string, Pair<Type, PluggableObjectEntry>>();
                Pluggables.Put(@namespace, namespaceMap);
            }

            namespaceMap.Put(
                name,
                new Pair<Type, PluggableObjectEntry>(clazz, new PluggableObjectEntry(type, optionalCustomConfig)));
        }