def METHOD_NAME(session, handler, req_args, *args, **kwargs):
    steps = session.query(models.Step) \
                   .filter(models.Step.questionnaire_id == req_args['questionnaire_id'],
                           models.Questionnaire.id == req_args['questionnaire_id'],
                           models.Questionnaire.tid == handler.request.tid)
    id_dict = {step.id: step for step in steps}
    ids = req_args['ids']
    if len(ids) != len(id_dict) and set(ids) != set(id_dict):
        raise errors.InputValidationError('list does not contain all context ids')
    for i, step_id in enumerate(ids):
        id_dict[step_id].order = i