code: func (cp *ClientProfile) SaveTo(loc ProfileLocation) error {
  	bytes, err := yaml.Marshal(&cp)
  	if err != nil {
  		return trace.Wrap(err)
  	}
  	if err = ioutil.WriteFile(loc.Path, bytes, 0660); err != nil {
  		return trace.Wrap(err)
  	}
  	if loc.AliasPath != "" && filepath.Base(loc.AliasPath) != filepath.Base(loc.Path) {
  		if err := os.Remove(loc.AliasPath); err != nil {
  			log.Warningf("Failed to remove symlink alias: %v", err)
  		}
  		err := os.Symlink(filepath.Base(loc.Path), loc.AliasPath)
  		if err != nil {
  			log.Warningf("Failed to create profile alias: %v", err)
  		}
  	}
  	// set 'current' symlink:
  	if loc.Options&ProfileMakeCurrent != 0 {
  		symlink := filepath.Join(filepath.Dir(loc.Path), CurrentProfileSymlink)
  		if err := os.Remove(symlink); err != nil {
  			log.Warningf("Failed to remove symlink: %v", err)
  		}
  		err = os.Symlink(filepath.Base(loc.Path), symlink)
  	}
  	return trace.Wrap(err)
  }
docs: // SaveTo saves the profile into a given filename, optionally overwriting it.