public async Task <IHttpActionResult> GetLatestStatsForDevice(string deviceid, string windowsize = "day", int?limit = 1000) { if (string.IsNullOrEmpty(deviceid)) { return(BadRequest()); } //deviceid = deviceid.ToLower(); return(Ok((await _statsService.GetLatestStatsForDevice(deviceid, windowsize, limit).ConfigureAwait(false)).OrderBy(item => item.time))); }