code: func (m *manager) Upload(extractedStemcell ExtractedStemcell, uploadStage biui.Stage) (cloudStemcell CloudStemcell, err error) {
  	manifest := extractedStemcell.Manifest()
  	stageName := fmt.Sprintf("Uploading stemcell '%s/%s'", manifest.Name, manifest.Version)
  	err = uploadStage.Perform(stageName, func() error {
  		foundStemcellRecord, found, err := m.repo.Find(manifest.Name, manifest.Version)
  		if err != nil {
  			return bosherr.WrapError(err, "Finding existing stemcell record in repo")
  		}
  
  		if found {
  			cloudStemcell = NewCloudStemcell(foundStemcellRecord, m.repo, m.cloud)
  			return biui.NewSkipStageError(bosherr.Errorf("Found stemcell: %#v", foundStemcellRecord), "Stemcell already uploaded")
  		}
  
  		cid, err := m.cloud.CreateStemcell(manifest.ImagePath, manifest.CloudProperties)
  		if err != nil {
  			return bosherr.WrapErrorf(err, "creating stemcell (%s %s)", manifest.Name, manifest.Version)
  		}
  
  		stemcellRecord, err := m.repo.Save(manifest.Name, manifest.Version, cid)
  		if err != nil {
  			//TODO: delete stemcell from cloud when saving fails
  			return bosherr.WrapErrorf(err, "saving stemcell record in repo (cid=%s, stemcell=%s)", cid, extractedStemcell)
  		}
  
  		cloudStemcell = NewCloudStemcell(stemcellRecord, m.repo, m.cloud)
  		return nil
  	})
  	if err != nil {
  		return cloudStemcell, err
  	}
  
  	return cloudStemcell, nil
  }
docs: // Upload stemcell to an IAAS. It does the following steps:
  // 1) uploads the stemcell to the cloud (if needed),
  // 2) saves a record of the uploaded stemcell in the repo