'Deletes account elsewhere unless the user would not be able
to log in anymore.'

def delete_elsewhere(self, platform, user_id):

    user_id = unicode(user_id)
    with self.db.get_cursor() as c:
        accounts = self.get_elsewhere_logins(c)
        assert (len(accounts) > 0)
        if ((len(accounts) == 1) and (accounts[0] == (platform, user_id))):
            raise LastElsewhere()
        c.one(u'\n                                                                DELETE    FROM    elsewhere\n                                                                WHERE    participant=%s\n                                                                AND    platform=%s\n                                                                AND    user_id=%s\n                                                                RETURNING    participant\n                                                ', (self.username, platform, user_id), default=NonexistingElsewhere)
        self.app.add_event(c, u'participant', dict(id=self.id, action=u'disconnect', values=dict(platform=platform, user_id=user_id)))
    self.update_avatar()
