code: func updateDeviceProfileFields(from models.DeviceProfile, to *models.DeviceProfile, w http.ResponseWriter) error {
  	if from.Description != "" {
  		to.Description = from.Description
  	}
  	if from.Labels != nil {
  		to.Labels = from.Labels
  	}
  	if from.Manufacturer != "" {
  		to.Manufacturer = from.Manufacturer
  	}
  	if from.Model != "" {
  		to.Model = from.Model
  	}
  	if from.Origin != 0 {
  		to.Origin = from.Origin
  	}
  	if from.Name != "" {
  		to.Name = from.Name
  		// Names must be unique for each device profile
  		if err := checkDuplicateProfileNames(*to, w); err != nil {
  			return err
  		}
  	}
  	if from.DeviceResources != nil {
  		to.DeviceResources = from.DeviceResources
  	}
  	if from.DeviceCommands != nil {
  		to.DeviceCommands = from.DeviceCommands
  	}
  	if from.CoreCommands != nil {
  		// Check for duplicates by command name
  		if err := checkDuplicateCommands(from, w); err != nil {
  			return err
  		}
  
  		// taking lazy approach to commands - remove them all and add them
  		// all back in. TODO - someday make this a two phase commit so
  		// commands don't get wiped out before profile
  
  		// Delete the old commands
  		if err := deleteCommands(*to, w); err != nil {
  			return err
  		}
  
  		to.CoreCommands = from.CoreCommands
  
  		// Add the new commands
  		if err := addCommands(to, w); err != nil {
  			return err
  		}
  	}
  
  	return nil
  }
docs: // Update the fields of the device profile
  // to - the device profile that was already in Mongo (whose fields we're updating)
  // from - the device profile that was passed in with the request