by Ron Meske.
For anyone looking to do something similar, I ended up creating a plugin that exposed a few functions as part of the Moodle API that provided the functionality I needed.