private void SaveDeviceDetail(DeviceEditViewModel model, string guid) { foreach (var log in model.Logs) { Stream stream = log.OpenReadStream(); using (StreamReader reader = new StreamReader(stream)) { string strxml = reader.ReadToEnd(); DeviceDetail deviceDetail = HelperXML.DESerializer <DeviceDetail>(strxml); deviceDetail.DeviceGUID = guid; _deviceRepository.AddDetail(deviceDetail); } } }