'Merge a user into existing users or add new if it doesn\'t exist.
Args:
kb_user: A User rdfvalue.
Returns:
A list of strings with the set attribute names, e.g. ["users.sid"]'

def MergeOrAddUser(self, kb_user):

    user = self.GetUser(sid=kb_user.sid, uid=kb_user.uid, username=kb_user.username)
    new_attrs = []
    merge_conflicts = []
    if (not user):
        new_attrs = self._CreateNewUser(kb_user)
    else:
        for (key, val) in kb_user.AsDict().items():
            if (user.Get(key) and (user.Get(key) != val)):
                merge_conflicts.append((key, user.Get(key), val))
            user.Set(key, val)
            new_attrs.append(('users.%s' % key))
    return (new_attrs, merge_conflicts)
