code: func checkUnitCreation(cCmd *cobra.Command, arg string) (int, error) {
  	name := unitNameMangle(arg)
  
  	// First, check if there already exists a Unit by the given name in the Registry
  	unit, err := cAPI.Unit(name)
  	if err != nil {
  		return 1, fmt.Errorf("error retrieving Unit(%s) from Registry: %v", name, err)
  	}
  
  	replace, _ := cCmd.Flags().GetBool("replace")
  
  	// check if the unit is running
  	if unit == nil {
  		if replace {
  			log.Debugf("Unit(%s) was not found in Registry", name)
  		}
  		// Create a new unit
  		return 0, nil
  	}
  
  	// if replace is not set then we warn in case the units differ
  	different, err := isLocalUnitDifferent(cCmd, arg, unit, false)
  
  	// if replace is set then we fail for errors
  	if replace {
  		if err != nil {
  			return 1, err
  		} else if different {
  			return checkReplaceUnitState(unit)
  		} else {
  			stdout("Found same Unit(%s) in Registry, nothing to do", unit.Name)
  		}
  	} else if different == false {
  		log.Debugf("Found same Unit(%s) in Registry, no need to recreate it", name)
  	}
  
  	return 1, nil
  }
docs: // checkUnitCreation checks if the unit should be created.
  // It takes a unit file path as a parameter.
  // It returns 0 on success and if the unit should be created, 1 if the
  // unit should not be created; and any error encountered.