**Context:** isolateLocation and Susceptibilities (1-many) have a one to many relationship as well as Drug and Susceptibilities (1-many). All are RealmObjects and IsolateLocation as well as Drug contains RealmList of Susceptibilities. A Susceptibility is created for all drugs in every isolateLocation, this Susceptibility is then added to the corresponding IsolateLocation Susceptibility list and Drug Susceptibility list.

**Problem:** The first Susceptibility object is added correctly to lists in both the models (Drug & IsolateLocation) but the next Susceptibility that is created is correctly added to the Drug model, immediately after adding it to the Drug Susceptibility list, the previous entry in the IsolateLocation Susceptibility list is deleted. So at the end Drug Susceptibility is correct with multiple Susceptibilities but IsolateLocation Susceptibility list only has 1.

**Raw Data:**
[http://imgur.com/a/iTPY8](https://imgur.com/a/iTPY8)

**Code:**

```
for (Drug drug : drugList){
    Susceptibility susceptibility = new Susceptibility();
    susceptibility.setId(UUID.randomUUID().toString());
    susceptibility.setDrug(drug);
    susceptibility.setReference(parsedCsv[drug.getId()+1]);
    susceptibility.setSusceptibilityValue(parsedCsv[drug.getId()]);
    susceptibility.setIsolateLocation(isolateLocation);
    addSusceptibilityToRealm(isolateLocation, drug, susceptibility);
    }

private void addSusceptibilityToRealm(IsolateLocation isolateLocation, Drug drug, Susceptibility susceptibility) {
    realm.beginTransaction();
    Drug drugEntry = realm.where(Drug.class).equalTo("id", drug.getId()).findFirst();
    drugEntry.getSusceptibilities().add(susceptibility);

    IsolateLocation isolateLocationEntry = realm.where(IsolateLocation.class).equalTo("id", isolateLocation.getId()).findFirst();
    isolateLocationEntry.getSusceptibilities().add(susceptibility);
    realm.commitTransaction();
}

```