public async Task <int> GetRepositoryStarsCount(RepositoryParameters parameters, int index)
        {
            string query = RepositorySearchToQuery(parameters);
            // cache stars count value to avoid excessive API requests
            var cacheKey    = $"StarsCount-{query}";
            var cachedValue = _cacheService.GetValue <int?>(cacheKey);
            int starsCount;

            if (cachedValue.HasValue)
            {
                starsCount = cachedValue.Value;
            }
            else
            {
                var searchResult = await this._client.Query <QueryData>(RepositoryQueries.REPOSITORY_STARS_QUERY,
                                                                        new
                {
                    query = query,
                    first = 1,
                    after = GraphQLHelper.GetCursor(index - 1)
                });

                if (searchResult.Search.Edges.Count == 0)
                {
                    throw new Exception("Repository is not found");
                }
                starsCount = searchResult.Search.Edges[0].Node.StargazerCount;
                _cacheService.SetValue(cacheKey, starsCount, TimeSpan.FromMinutes(STARS_COUNT_CACHE_EXPIRATION_TIME_IN_MINUTES));
            }
            return(starsCount);
        }
        public async Task <List <Repository> > GetRepositoriesAsync(RepositoryParameters parameters,
                                                                    int from, int count)
        {
            string query        = RepositorySearchToQuery(parameters);
            var    searchResult = await this._client.Query <QueryData>(RepositoryQueries.REPOSITORY_SEARCH_QUERY,
                                                                       new
            {
                query         = query,
                first         = count,
                after         = GraphQLHelper.GetCursor(from - 1),
                languageCount = MAX_LANGUAGES_COUNT
            });

            return(searchResult.Search.Edges.Select(e => ConvertEdgeToRepository(e)).ToList());
        }