public JsonResult GetMeters()
{
if (graphService.app_id != resellerService.crest_app_id || !graphService.initialized)
graphService.Initialize(resellerService.tenant_name, resellerService.crest_app_id, resellerService.crest_app_key);
if (!crestService.initialized)
crestService.Initialize(graphService.oauth_token.token, resellerService.crest_account_id);
if (resellerService.rateCard.Meters == null)
resellerService.rateCard = crestService.GetRateCard();
List<Meter> meters = resellerService.rateCard.Meters.OrderBy(x => x.MeterCategory).ThenBy(x => x.MeterSubCategory).ThenBy(x => x.MeterName).ToList<Meter>();
return Json(new { Result = "OK", Records = meters, TotalRecordCount = meters.Count });
}