def create_session(cls, session_id, user_id):
        """
        Save a new session to the database
        Using the ['AUTH']['MAX_SESSIONS'] config setting
        a session with be created within the MAX_SESSIONS
        limit. Once this limit is hit, delete the earliest
        session.
        """
        count = SessionModel.count(user_id)
        if count < current_app.config['AUTH']['MAX_SESSIONS']:
            cls.__save_session(session_id, user_id)
            return
        elif count >= current_app.config['AUTH']['MAX_SESSIONS']:
            earliest_session = SessionModel.where_earliest(user_id)
            earliest_session.delete()
            cls.__save_session(session_id, user_id)
            return