Fix multiple words references names

Entities with multiple word names were serialized with bad key. Ex. UserPermission => userpermission_id instead of user_permission_id.