/// <summary> /// Runs the processor /// </summary> /// <param name="Request"></param> /// <returns></returns> public async Task <LogScanResponse> Run(LogScanRequest Request) { m_logger.LogInformation(LogEventId.LogScanStart, string.Format("Sending {0} Scans to MongoDB.", Request.Scans.Count)); LogScanResponse Response = null; foreach (ScanModel scan in Request.Scans) { var coords = new GeoJson2DCoordinates(scan.Kinematics.Latitude, scan.Kinematics.Longitude); scan.Kinematics.Location = GeoJson.Point <GeoJson2DCoordinates>(coords); /// Was a local configuraiton used in this scan? if (scan.Configuration != null && scan.Configuration.Count != 0) { // if so, then register that configuration and set the global Id to it scan.GlobalConfigurationId = await m_settingServiceClient.RegisterConfigurationAsync(scan.Configuration); } } try { await m_scanCollection.InsertManyAsync(Request.Scans); Response = new LogScanResponse(true); m_logger.LogInformation(LogEventId.LogScanSuccess, "Scans inserted into MongoDB."); } catch (Exception e) { m_logger.LogError(LogEventId.LogScanError, "Error Logging scans: {0}", e.ToString()); } return(Response); }