Fixing issue with related IDs not being set in toJSON() if fetchRelated() not called

When using lazy-loading of related objects, toJSON() does not include the original IDs if the object has not been loaded.  This fixes the loss of related data.