code: function AddDetector (detector, force = false, subEnvironmentName) {
    log.info(`Attempting to add detector ${detector.name} with force=${force}...`)
    if (force || (detector instanceof ent.MotionDetector)) {
      log.info(`Pushing detector "${detector.name}"" to main...`)
      motionDetectors.push(detector)
      if (AddDetectorToSubEnvironmentOnly(detector, force, subEnvironmentName)) {
        return true
      } else {
        if (em.GetEnvironment()) {
          log.info(`Binding detector to environment ${em.GetEnvironment().constructor.name}...`)
          em.GetEnvironment().bindDetector(detector, em.GetNotifiers(), force)
          detector.startMonitoring()
          return true
        } else {
          throw new Error('No environment was detected, please add one first.')
        }
      }
    } else {
      log.warning(`${detector} object is not of type MotionDetector`)
    }
    return false
  }
docs: Adds a detector or detectors (in form of array) to the {Environment} in the {motionDetectors}
  internal variable.
  Checks that the notifier is of {BaseNotifier} instance. Allows to force adding a notifier event if not
  of the correct type, by setting force = true.
  Fails silently (returns false) if the detector is not of {MotionDetector} type, and logs the occurence.
  Fails hard (throws an Error) if there is no existing {Environment} set in the context at the runtime.
  @param {object} detector is the MotionDetector object to add.
  @param {boolean} force can be set to true to push the detector even if not of {MotionDetector} instance
  @param {string} subEnvironmentName is the name of a Sub-Environment existing instance
  @returns {Boolean} true if the detector is successfully created.
  @public