public override void Deserialize(string i_QueryResult, AppointmentBookingData i_ABData, AdditionalObjectsUtils.eAdditionalObjectQuery i_AdditionalObjQuery = default, bool async = false) { DeserializedQueryResult deserializedQuery = JsonConvert.DeserializeObject <DeserializedQueryResult>(i_QueryResult); ServiceAppointmentUtils serviceUtils = new ServiceAppointmentUtils(i_ABData); Dictionary <string, ServiceAppointment> deserializedServices = serviceUtils.parseAdditionalData(deserializedQuery.records); foreach (KeyValuePair <string, List <Time_Dependency__c> > dependencyTreeByRoot in i_ABData.TimeDependeciesByRootId) { foreach (Time_Dependency__c dependency in dependencyTreeByRoot.Value) { if (!i_ABData.ServicesById.ContainsKey(dependency.Service_Appointment_1__c)) { i_ABData.ServicesById[dependency.Service_Appointment_1__c] = deserializedServices[dependency.Service_Appointment_1__c]; } dependency.Service_Appointment_1__r = deserializedServices[dependency.Service_Appointment_1__c]; if (!i_ABData.ServicesById.ContainsKey(dependency.Service_Appointment_2__c)) { i_ABData.ServicesById[dependency.Service_Appointment_2__c] = deserializedServices[dependency.Service_Appointment_2__c]; } dependency.Service_Appointment_2__r = deserializedServices[dependency.Service_Appointment_2__c]; if (dependency.Service_Appointment_1__c == dependency.Root_Service_Appointment__c) { dependency.Root_Service_Appointment__r = deserializedServices[dependency.Service_Appointment_1__c]; } if (dependency.Service_Appointment_2__c == dependency.Root_Service_Appointment__c) { dependency.Root_Service_Appointment__r = deserializedServices[dependency.Service_Appointment_2__c]; } } } }