protected void AddRelatedObject(string relatedObjectType, string relatedObjectIdentifier, Dictionary <string, string> relatedRecord) { //TODO: set state IDataObject relatedObject = new SerializableDataObject() { Type = relatedObjectType, Id = relatedObjectIdentifier }; if (relatedObject.GetType() == typeof(GenericDataObject)) { ((GenericDataObject)relatedObject).ObjectType = relatedObjectType; } foreach (var relatedRecordPair in relatedRecord) { relatedObject.SetPropertyValue(relatedRecordPair.Key, relatedRecordPair.Value); } _dataObjects.Add(relatedObject); }