Fixed typo

Fixed a typo in rest_serializer#serializeIntoHash
typo in embedded_records_mixin docs
Refactor relationship handling code

Fixes #1919 #1814 #2057 #2191 #2177 #2125 #2100 #1848 #1790 #1532 #1389 #1308