public void SaveBaseInfo(string type, StationInfo info, int parentRegionId) { try { Action<int, StationInfo> AddRegionAndDevice = (scadaMapping, info2) => { }; AddRegionAndDevice = (regionId, stationInfo) => { regionId = UpdateDevice(type, stationInfo, regionId); if (stationInfo.Children != null && stationInfo.Children.Count != 0) { foreach (var item in stationInfo.Children) { AddRegionAndDevice(regionId,item); } } }; if (info.Children != null && info.Children.Count != 0) { foreach (StationInfo item2 in info.Children) { AddRegionAndDevice(parentRegionId, item2); } } } catch (Exception ex) { Program.Log.Error(ex); } }