// TODO: Change no internet connection handling

        /// <summary>
        /// Fetches and stores all data from a specific Eurostat dataset.
        /// </summary>
        /// <param name="table">Representation of the dataset. Has information needed to fetch.</param>
        /// <returns></returns>
        private async Task FetchAndStore(EuroStatTable table)
        {
            List <Nace> naces = await databaseStore.getAllNaces();

            int iterationCount = GetFetchIterationsCount(naces);

            for (int i = 0; i < iterationCount; i++)
            {
                string url = GetEuroStatURL(table, i, naces, StartYear, EndYear);
                try
                {
                    HttpResponseMessage response = await client.GetAsync(url);

                    if (response.IsSuccessStatusCode)
                    {
                        string jsonString = response.Content.ReadAsStringAsync().Result;
                        List <NaceRegionData> EurostatNRData = await JSONConverter.Convert(jsonString, table.attributeName);

                        await databaseStore.addNaceRegionData(EurostatNRData);
                    }
                    else
                    {
                        await handleStatusCodeNotSuccess((int)response.StatusCode, response, table, url);
                    }
                }
                catch (System.Net.Http.HttpRequestException e)
                {
                    _logger.LogWarning("No internet connection, check your network configuration and try again" + "\nError trace: " + e);
                    throw new Exception();
                }
            }
        }