code: func (fr *fileReader) saveDashboard(path string, folderId int64, fileInfo os.FileInfo, provisionedDashboardRefs map[string]*models.DashboardProvisioning) (provisioningMetadata, error) {
  	provisioningMetadata := provisioningMetadata{}
  	resolvedFileInfo, err := resolveSymlink(fileInfo, path)
  	if err != nil {
  		return provisioningMetadata, err
  	}
  
  	provisionedData, alreadyProvisioned := provisionedDashboardRefs[path]
  	upToDate := alreadyProvisioned && provisionedData.Updated >= resolvedFileInfo.ModTime().Unix()
  
  	jsonFile, err := fr.readDashboardFromFile(path, resolvedFileInfo.ModTime(), folderId)
  	if err != nil {
  		fr.log.Error("failed to load dashboard from ", "file", path, "error", err)
  		return provisioningMetadata, nil
  	}
  
  	if provisionedData != nil && jsonFile.checkSum == provisionedData.CheckSum {
  		upToDate = true
  	}
  
  	// keeps track of what uid's and title's we have already provisioned
  	dash := jsonFile.dashboard
  	provisioningMetadata.uid = dash.Dashboard.Uid
  	provisioningMetadata.title = dash.Dashboard.Title
  
  	if upToDate {
  		return provisioningMetadata, nil
  	}
  
  	if dash.Dashboard.Id != 0 {
  		dash.Dashboard.Data.Set("id", nil)
  		dash.Dashboard.Id = 0
  	}
  
  	if alreadyProvisioned {
  		dash.Dashboard.SetId(provisionedData.DashboardId)
  	}
  
  	fr.log.Debug("saving new dashboard", "provisioner", fr.Cfg.Name, "file", path, "folderId", dash.Dashboard.FolderId)
  	dp := &models.DashboardProvisioning{
  		ExternalId: path,
  		Name:       fr.Cfg.Name,
  		Updated:    resolvedFileInfo.ModTime().Unix(),
  		CheckSum:   jsonFile.checkSum,
  	}
  
  	_, err = fr.dashboardProvisioningService.SaveProvisionedDashboard(dash, dp)
  	return provisioningMetadata, err
  }
docs: // saveDashboard saves or updates the dashboard provisioning file at path.