code: func (h *handler) persistDocAndPages(ctx context.Context, newDoc document) (blob.Ref, error) {
  	br := blob.Ref{}
  	pn, err := h.createDocument(ctx, newDoc)
  	if err != nil {
  		return br, err
  	}
  	for _, page := range newDoc.pages {
  		if err := h.setAttribute(ctx, page, "document", pn.String()); err != nil {
  			return br, fmt.Errorf("could not update scan %v with %v:%v", page, "document", pn)
  
  		}
  	}
  	return pn, nil
  }
docs: // persistDocAndPages creates a new Document struct that represents
  // the given mediaObject structs and stores it in the datastore, updates each of
  // these mediaObject in the datastore with references back to the new Document struct
  // and returns the key to the new document entity