// Serialize the batch into temp xml file, and return the path to it. public string SerializeBatchRequestToFile(batchRequest cnpBatchRequest, string filePath) { // Create cnpRequest xml file if not exist. // Otherwise, the xml file created, thus storing some batch requests. filePath = cnpFile.createRandomFile(requestDirectory, Path.GetFileName(filePath), "_temp_cnpRequest.xml", cnpTime); // Serializing the batchRequest creates an xml for that batch request and returns the path to it. var tempFilePath = cnpBatchRequest.Serialize(); // Append the batch request xml just created to the accummulating cnpRequest xml file. cnpFile.AppendFileToFile(filePath, tempFilePath); // Return the path to temp xml file. return(filePath); }