public static ViewKeyCollection FromQueryResult(ItemQueryResult queryResult)
        {
            ViewKeyCollection keys = new ViewKeyCollection();

            if (queryResult != null)
            {
                if (queryResult.HasItems)
                {
                    keys.AddFromItems(queryResult.Items);
                }
                if (queryResult.HasPending)
                {
                    keys.AddFromPendingItems(queryResult.PendingItems);
                }
            }

            return(keys);
        }
        internal async Task SynchronizeAsyncImpl(CancellationToken cancelToken)
        {
            if (!m_data.HasQuery)
            {
                throw new ArgumentException("Query");
            }

            ItemQuery           query        = m_data.Query;
            int                 maxResults   = (query.MaxResults) != null ? m_data.Query.MaxResults.Value : 0;
            IList <PendingItem> pendingItems = await Record.GetKeysAndDateAsync(query.Filters, maxResults).AsTask(cancelToken);

            ViewKeyCollection newKeys = new ViewKeyCollection();

            if (!pendingItems.IsNullOrEmpty())
            {
                newKeys.AddFromPendingItems(pendingItems);
            }

            this.UpdateKeys(newKeys);
        }