public HomePageViewModel()
        {
            var worldRepository = new WorldDataRepository();

            Data = new ObservableCollection<DataItem>();
            ItemsSource = new ObservableCollection<CountryItem>();

            worldRepository.GetCountries().ContinueWith(list =>
            {
                Countries = list.Result;
                var dataItems = new ObservableCollection<DataItem>();
                foreach (var item in Countries)
                {
                    var countryItem = new CountryItem
                    {
                        Name = item.Name,
                        Change = item.Chg1Y,
                        IsChangePositive = item.IsChangePositive
                    };
                    double val = 0.0;
                    double.TryParse(item.LifeExpectancy, out val);
                    countryItem.LifeExpectancy = val;
                    ItemsSource.Add(countryItem);

                }
                foreach (var region in worldRepository.CountriesByRegion)
                {
                    var dataItem = new DataItem {Label = region.Key, Level = region.Value.Sum(x => x.Level.ToDouble())};
                    dataItems.Add(dataItem);
                }
                WorldPopulation = dataItems.Sum(l => l.Level * 1000).ToString("#,##0,,,.B", CultureInfo.InvariantCulture);
                LifeExpectancy = ItemsSource.Average(x => x.LifeExpectancy).ToString("00.00", CultureInfo.InvariantCulture);
                Data = dataItems;
            });
        }
        public HomePageViewModel()
        {
            var worldRepository = new WorldDataRepository();

            Data = new ObservableCollection<DataItem>();
            ItemsSource = new ObservableCollection<Item>();

            worldRepository.GetCountries().ContinueWith((list) =>
            {
                Countries = list.Result;
                var data = new ObservableCollection<DataItem>();
                foreach (var item in Countries)
                {
                    ItemsSource.Add(new Item { Name = item.Name, Change = item.Chg1Y, IsChangePositive = item.IsChangePositive});
                }
                foreach (var region in worldRepository.CountriesByRegion)
                {
                    var dataItem = new DataItem();
                    dataItem.Label = region.Key;
                    dataItem.Level = region.Value.Sum(x => x.Level.ToDouble());
                    data.Add(dataItem);
                }
                Data = data;
            });
        }