code: func workItemIncludeHasChildren(ctx context.Context, appl application.Application, childLinks ...link.WorkItemLinkList) WorkItemConvertFunc {
  	// TODO: Wrap ctx in a Timeout context?
  	return func(request *http.Request, wi *workitem.WorkItem, wi2 *app.WorkItem) error {
  		var hasChildren bool
  		// If we already have information about children inside the child links
  		// we can use that before querying the DB.
  		if len(childLinks) == 1 {
  			for _, l := range childLinks[0] {
  				if l.LinkTypeID == link.SystemWorkItemLinkTypeParentChildID && l.SourceID == wi.ID {
  					hasChildren = true
  				}
  			}
  		}
  		if !hasChildren {
  			var err error
  			repo := appl.WorkItemLinks()
  			if repo != nil {
  				hasChildren, err = appl.WorkItemLinks().WorkItemHasChildren(ctx, wi.ID)
  				log.Info(ctx, map[string]interface{}{"wi_id": wi.ID}, "Work item has children: %t", hasChildren)
  				if err != nil {
  					log.Error(ctx, map[string]interface{}{
  						"wi_id": wi.ID,
  						"err":   err,
  					}, "unable to find out if work item has children: %s", wi.ID)
  					// enforce to have no children
  					hasChildren = false
  					return errs.Wrapf(err, "failed to determine if work item %s has children", wi.ID)
  				}
  			}
  		}
  		if wi2.Relationships.Children == nil {
  			wi2.Relationships.Children = &app.RelationGeneric{}
  		}
  		wi2.Relationships.Children.Meta = map[string]interface{}{
  			"hasChildren": hasChildren,
  		}
  		return nil
  	}
  }
docs: // workItemIncludeHasChildren adds meta information about existing children