Migrated second half of child record handling to separate module to allow reuse in /api/records and /api/record (CTR-86).
Fixed typo in variable name.
Migrated /api/records to use common child handling (CTR-86).
Added proper support for children in /api/records in a performant way (CTR-86).