private async Task<DeviceDataCollection> HandleResponse(string data)
		{
			return await Task.Run (()=>{

				var cloudantData = JsonConvert.DeserializeObject<CloudantData> (data);
				if (cloudantData == null) {
					return null;
				}

				var deviceDataCollection = new DeviceDataCollection ();
				foreach (var item in cloudantData.Rows) {
					item.Doc.DeviceData.Timestamp = item.Doc.DeviceData.Timestamp.ToLocalTime();
					deviceDataCollection.Add (item.Doc.DeviceData);
				}

				return deviceDataCollection;
			});

		}
        private async Task <DeviceDataCollection> HandleResponse(string data)
        {
            return(await Task.Run(() => {
                var cloudantData = JsonConvert.DeserializeObject <CloudantData> (data);
                if (cloudantData == null)
                {
                    return null;
                }

                var deviceDataCollection = new DeviceDataCollection();
                foreach (var item in cloudantData.Rows)
                {
                    item.Doc.DeviceData.Timestamp = item.Doc.DeviceData.Timestamp.ToLocalTime();
                    deviceDataCollection.Add(item.Doc.DeviceData);
                }

                return deviceDataCollection;
            }));
        }
        public async Task <DeviceDataCollection> GetDeviceData()
        {
            return(await Task.Run(() =>
            {
                var deviceDataCol = new DeviceDataCollection();

                var csv = DataProvider.GetResourceCsvFileData(@"BluemixIoT.Data.air_quality.csv");
                for (var i = 1; i < csv.Rows.Count; i++)
                {
                    var data = csv[i, "d"];
                    var deviceData = new DeviceData
                    {
                        Id = csv[i, "_id"],
                        Data = JsonConvert.DeserializeObject <AirQuality>(csv[i, "d"]),
                        Timestamp = Convert.ToDateTime(csv[i, "ts"]),
                    };
                    deviceDataCol.Add(deviceData);
                }

                return deviceDataCol;
            }));
        }
		public async Task<DeviceDataCollection> GetDeviceData()
		{
			return await Task.Run(() =>
				{
					var deviceDataCol = new DeviceDataCollection();

					var csv = DataProvider.GetResourceCsvFileData(@"BluemixIoT.Data.air_quality.csv");
					for (var i = 1; i < csv.Rows.Count; i++)
					{
						var data = csv[i, "d"];
						var deviceData = new DeviceData
						{
							Id = csv[i, "_id"],
							Data = JsonConvert.DeserializeObject<AirQuality>(csv[i, "d"]),
							Timestamp = Convert.ToDateTime(csv[i, "ts"]),
						};
						deviceDataCol.Add(deviceData);
					}

					return deviceDataCol;
				});


		}