public async Task MoveSim(SimObject simObject) { GridBlock gridBlock; try { //Gets a random direction and attempts to move the sim gridBlock = await _gridManager.MoveInDirection(simObject, await GetRandomDirection().ConfigureAwait(false)).ConfigureAwait(false); if (gridBlock != null) { var telemetryDataPoint = new TelemetryDataPoint { DeviceId = simObject.IoTDeviceInfo.DeviceId, Name = simObject.Name, Type = simObject.Type, Grid_x = gridBlock.Location.Rowx, Grid_y = gridBlock.Location.Columny, InZone = gridBlock.IsZone, Operation = "move_completed" }; await SendIoTHubMessage(simObject, telemetryDataPoint).ConfigureAwait(false); } } catch (LocationOccupiedException lex) { _logger.LogError(lex.Message); } catch (OffTheGridException oex) { _logger.LogError(oex.Message); } }