private bool AlreadyExists(IActorProducerPlugin plugin)
        {
            var pluginType    = plugin.GetType();
            var alreadyExists = _plugins.Any(p => p.GetType() == pluginType);

            return(alreadyExists);
        }
        /// <summary>
        /// Register target <paramref name="plugin"/> inside producer pipeline at specified <paramref name="index"/>.
        /// </summary>
        /// <param name="index">TBD</param>
        /// <param name="plugin">TBD</param>
        /// <returns>True if plugin was registered (it has not been found in pipeline already). False otherwise. </returns>
        public bool Insert(int index, IActorProducerPlugin plugin)
        {
            if (!AlreadyExists(plugin))
            {
                _plugins.Insert(index, plugin);
                return(true);
            }

            return(false);
        }
        /// <summary>
        /// Register target <paramref name="plugin"/> at the end of producer pipeline.
        /// </summary>
        /// <param name="plugin">TBD</param>
        /// <returns>True if plugin was registered (it has not been found in pipeline already). False otherwise. </returns>
        public bool Register(IActorProducerPlugin plugin)
        {
            if (!AlreadyExists(plugin))
            {
                _plugins.Add(plugin);
                return(true);
            }

            return(false);
        }
 /// <summary>
 /// Returns true if current actor producer pipeline already has registered provided plugin type.
 /// </summary>
 /// <param name="plugin">TBD</param>
 /// <returns>TBD</returns>
 public bool IsRegistered(IActorProducerPlugin plugin)
 {
     return(_plugins.Any(p => p.GetType() == plugin.GetType()));
 }
 /// <summary>
 /// Unregisters plugin from producer pipeline, returning false if plugin was not found.
 /// </summary>
 /// <param name="plugin">TBD</param>
 /// <returns>TBD</returns>
 public bool Unregister(IActorProducerPlugin plugin)
 {
     return(_plugins.Remove(plugin));
 }