func removeKeyFromDatabase(key *auth.Key, u *auth.User) error { conn, err := db.Conn() if err != nil { return err } defer conn.Close() u.RemoveKey(*key) return conn.Users().Update(bson.M{"email": u.Email}, u) }