Fix toArray() infinite loop bug in embeds many relation

Because both related and parent have the relation set, an infinite loop occured when we called `toArray()` or `relationsToArray()` methods.

That's fixed.