refactor recursive lti course id query
refactor recursive lti course id query

Change-Id: If673621b3187be60d7ca6a6b505622105576404b
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/232109
Tested-by: Cody Cutrer <c4fe2b1d90ef8f2548c8aeabfa633434316f0305@instructure.com>
Reviewed-by: Cody Cutrer <c4fe2b1d90ef8f2548c8aeabfa633434316f0305@instructure.com>
QA-Review: Cody Cutrer <c4fe2b1d90ef8f2548c8aeabfa633434316f0305@instructure.com>
Product-Review: Cody Cutrer <c4fe2b1d90ef8f2548c8aeabfa633434316f0305@instructure.com>

djbender/canvas-lms,sfu/canvas-lms,djbender/canvas-lms,djbender/canvas-lms,sfu/canvas-lms,sfu/canvas-lms,sfu/canvas-lms,sfu/canvas-lms,sfu/canvas-lms,sfu/canvas-lms,djbender/canvas-lms