public void SendData(IRelationalObject relationalObject) { if (relationalObject == null) { throw new ArgumentNullException(nameof(relationalObject)); } if (!streams.ContainsKey(configuration)) { var fileName = configuration.FileName; var factory = new OutputStreamFactory(configuration.Format, configuration.ColumnHeaders, serialiser); var writer = streamFactory.OpenWrite(fileName); streams.Add(configuration, new FileStream(factory.Create(writer))); } var stream = streams[configuration]; var bindingConfig = configuration as IBindingConfiguration; if (bindingConfig != null) { relationalObject = relationalObject.WithForeignKey(bindingConfig); } stream.SendData(relationalObject); }