/// <summary>
        /// The controller module uses the prototype design pattern
        /// to be able to create new controller objects for requests
        /// if the stack is empty.
        /// </summary>
        /// <param name="prototype">A prototype which will be cloned for each request</param>
        /// <exception cref="ArgumentNullException"></exception>
        /// <exception cref="InvalidProgramException">If a controller with that name have been added already.</exception>
        /// <exception cref="InvalidOperationException">A controller with the same name exists.</exception>
        public void Add(RestRequestController prototype)
        {
            lock (_controllers) {
                if (_controllers.ContainsKey(prototype.ControllerName))
                    throw new InvalidOperationException("Controller with name '" + prototype.ControllerName + "' already exists.");

                _controllers.Add(prototype.ControllerName, new RestControllerContext(prototype));
            }
        }
 /// <summary>
 /// Add a controller
 /// </summary>
 /// <param name="controller"></param>
 public void Push(RestRequestController controller)
 {
     lock (_queue) {
         _queue.Enqueue(controller);
     }
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="RestControllerContext"/> class.
 /// </summary>
 /// <param name="prototype">A controller used to handle certain URLs. Will be cloned for each parallel request.</param>
 public RestControllerContext(RestRequestController prototype)
 {
     _prototype = prototype;
 }