code: func (r Resources) upsert(method string, route string, resource *Resource) error {
  	currentNode := r
  
  	parts := strings.Split(route, "/")
  	if len(parts) > 0 {
  		last := len(parts) - 1
  
  		// Upsert route of the resource.
  		for _, part := range parts[:last] {
  			if part == "" {
  				continue
  			}
  			part = "/" + part
  
  			node, found := currentNode[part]
  			if !found {
  				node = &Resource{
  					Resources: Resources{},
  					Responses: Responses{},
  				}
  
  				currentNode[part] = node
  			}
  			currentNode = node.Resources
  		}
  
  		if parts[last] != "" {
  			// Upsert resource into the very bottom of the node tree.
  			part := "/" + parts[last]
  			node, found := currentNode[part]
  			if !found {
  				node = &Resource{
  					Resources: Resources{},
  					Responses: Responses{},
  				}
  			}
  			currentNode[part] = node
  			currentNode = node.Resources
  		}
  	}
  
  	method = strings.ToLower(method)
  	if _, found := currentNode[method]; found {
  		return nil
  		// return fmt.Errorf("duplicated method route: %v %v", method, route)
  	}
  
  	currentNode[method] = resource
  
  	return nil
  }
docs: // Find or create node tree from a given route and inject the resource.