private IHttpActionResult GetDataResult <TEntity>(string where, int count, string sortBy, string groupBy, string pagingToken, string[] fields = null) where TEntity : ListItemEntity, new() { try { using (ClientContext context = new Authentication.LowTrustTokenHelper(_tokenHelper).GetUserClientContext()) { var result = new DataResult <TEntity>(); result.Load(context, where, count, sortBy, groupBy, pagingToken, fields); return(Json(result)); } } catch (Exception ex) { return(new JsonErrorResult(ex)); } }