Most of this code was taken straight from the schema service. No tests were written because this is entirely dependent on external dependencies.