func moveOneContainerInDB(a *app.App, oldContainer container, newUnit provision.Unit) error { appDBMutex.Lock() defer appDBMutex.Unlock() err := a.AddUnitsToDB([]provision.Unit{newUnit}) if err != nil { return err } return a.RemoveUnitFromDB(oldContainer.ID) }