func appendIfMissing(slice []user.User, u user.User) ([]user.User, bool) { for _, ele := range slice { if u.Equals(ele) { return slice, false } } return append(slice, u), true }
func removeFromSlice(slice []user.User, u user.User) ([]user.User, bool) { removed := false newslice := make([]user.User, 0, len(slice)) for _, ele := range slice { if !u.Equals(ele) && ele.ID != "" { newslice = append(newslice, ele) } else { removed = true } } return newslice, removed }