public async Task <IEnumerable <ILotState> > GetAsync(ICriterion filter, IList <string> orders = null, int firstResult = 0, int maxResults = int.MaxValue, IList <string> fields = null)
        {
            IEnumerable <ILotState> states = null;
            var q = new LotsGetQuery();

            q.FirstResult = firstResult;
            q.MaxResults  = maxResults;
            q.Sort        = LotProxyUtils.GetOrdersQueryValueString(orders);
            q.Fields      = LotProxyUtils.GetReturnedFieldsQueryValueString(fields, QueryFieldValueSeparator);
            q.Filter      = LotProxyUtils.GetFilterQueryValueString(filter);
            var req = new LotsGetRequest();

            req.Query = q;
            var resp = await _ramlClient.Lots.Get(req);

            LotProxyUtils.ThrowOnHttpResponseError(resp);
            states = (resp.Content == null) ? null : resp.Content.Select(e => e.ToLotState());
            return(states);
        }
        public async virtual Task <long> GetCountAsync(ICriterion filter)
        {
            var q = new LotsCountGetQuery();

            q.Filter = LotProxyUtils.GetFilterQueryValueString(filter);
            var req = new LotsCountGetRequest();

            req.Query = q;
            var resp = await _ramlClient.LotsCount.Get(req);

            LotProxyUtils.ThrowOnHttpResponseError(resp);
            string str = await resp.RawContent.ReadAsStringAsync();

            if (str.StartsWith("\""))
            {
                str = str.Substring(1);
            }
            if (str.EndsWith("\""))
            {
                str = str.Substring(0, str.Length - 1);
            }
            return(long.Parse(str));
        }