Nested objects update issue

i asked this question on StackOverflow, but i didn’t get any answer.
orignal post is here (sorry for copy-paste)

I have an app that stores lots of data to work offline as well.
I have three classes, in a hierarchy like;

public class MainGroup
{
private UUID Oid;
private String name;
private Date CreatedOn;
}

public class Group
{
 private UUID Oid;
 private String name;
 private Date CreatedOn;
 private MainGruop MainGroup;
}
public class Product
{
 private UUID Oid;
 private String name;
 private Date CreatedOn;
 private MainGruop MainGroup;
 private Group Group;
}

( Oid fields are selected as PrimaryKey with realm attribute. )

Let’s say, all MainProduct objects were stored in Realm DB. Then, when i’m trying to insert Group objects, with nested MainGroup object but with only its Oid field to link its master, Realm updates the MainProduct record (with given Oid), and clear the other fields as nulls.

In same way, when i’m inserting Product objects and nested objects are includes only Oid, realm updates all fields with nulls.

So, there are more complex and deeply related objects and when i make a request to get JSON from server, i must produce a very big JSON response to keep data.

And mention to insert method; I’m creating java objects with JSON response via GSON and i’m using Realm.copyToRealmOrUpdate(obj); method to insert.

To reduce payload (JSON size, serialize and insertion process), i need to find a way to fix this issue.