code: func AddControllerType(moduleSource *Module, controllerType reflect.Type, methods []*MethodType) (newControllerType *ControllerType) {
  	if moduleSource == nil {
  		moduleSource = appModule
  	}
  
  	newControllerType = &ControllerType{ModuleSource: moduleSource, Type: controllerType, Methods: methods, ControllerIndexes: findControllers(controllerType)}
  	newControllerType.ControllerEvents = NewControllerTypeEvents(newControllerType)
  	newControllerType.Namespace = moduleSource.Namespace()
  	controllerName := newControllerType.Name()
  
  	// Store the first controller only in the controllers map with the unmapped namespace.
  	if _, found := controllers[controllerName]; !found {
  		controllers[controllerName] = newControllerType
  		newControllerType.ModuleSource.AddController(newControllerType)
  		if newControllerType.ModuleSource == appModule {
  			// Add the controller mapping into the global namespace
  			controllers[newControllerType.ShortName()] = newControllerType
  		}
  	} else {
  		controllerLog.Errorf("Error, attempt to register duplicate controller as %s", controllerName)
  	}
  	controllerLog.Debugf("Registered controller: %s", controllerName)
  
  	return
  }
docs: // Adds the controller to the controllers map using its namespace, also adds it to the module list of controllers.
  // If the controller is in the main application it is added without its namespace as well.