Fix assertion error on delete with records that have hasMany relationships
accepting PR from HospitalRun, deleteRecord causes failed assertion