Confirm email with link
        A universal method to confirm email. used for both initial
        confirmation and when email is changed.

def confirm_email_with_link(self, link):
        """
        Confirm email with link
        A universal method to confirm email. used for both initial
        confirmation and when email is changed.
        """
        user = self.first(email_link=link)
        if not user:
            return False
        elif user and user.email_confirmed:
            return True
        elif user and user.email_link_expired():
            raise x.EmailLinkExpired('Link expired, generate a new one')

        # confirm otherwise
        user.confirm_email()
        db.session.add(user)
        db.session.commit()
        events.email_confirmed_event.send(user)
        return user