code: func (db *SQLDB) ResolvingTask(logger lager.Logger, taskGuid string) (*models.Task, *models.Task, error) {
  	logger = logger.Session("resolving-task", lager.Data{"task_guid": taskGuid})
  	logger.Info("starting")
  	defer logger.Info("complete")
  
  	var beforeTask models.Task
  	var afterTask *models.Task
  
  	err := db.transact(logger, func(logger lager.Logger, tx helpers.Tx) error {
  		var err error
  		afterTask, err = db.fetchTaskForUpdate(logger, taskGuid, tx)
  		if err != nil {
  			logger.Error("failed-locking-task", err)
  			return err
  		}
  
  		beforeTask = *afterTask
  
  		if err = afterTask.ValidateTransitionTo(models.Task_Resolving); err != nil {
  			logger.Error("invalid-state-transition", err)
  			return err
  		}
  
  		now := db.clock.Now().UnixNano()
  		_, err = db.update(logger, tx, tasksTable,
  			helpers.SQLAttributes{
  				"state":      models.Task_Resolving,
  				"updated_at": now,
  			},
  			"guid = ?", taskGuid,
  		)
  		if err != nil {
  			logger.Error("failed-updating-tasks", err)
  			return err
  		}
  
  		afterTask.State = models.Task_Resolving
  		afterTask.UpdatedAt = now
  
  		return nil
  	})
  
  	return &beforeTask, afterTask, err
  }
docs: // The stager calls this when it wants to claim a completed task.  This ensures that only one
  // stager ever attempts to handle a completed task