private async Task GetSampleDataAsync()
        {
            Uri         dataUri = new Uri("ms-appx:///DataModel/InitialData.json");
            StorageFile file    = await StorageFile.GetFileFromApplicationUriAsync(dataUri);

            string jsonText = await FileIO.ReadTextAsync(file);

            // Ensure that we have a valid access token before updating the data
            string accessToken = await AuthenticationHelper.EnsureAccessTokenAvailableAsync();

            lock (this.Groups)
            {
                if (this.Groups.Count != 0)
                {
                    return;
                }

                JsonObject jsonObject = JsonObject.Parse(jsonText);
                JsonArray  jsonArray  = jsonObject["Groups"].GetArray();

                foreach (JsonValue groupValue in jsonArray)
                {
                    JsonObject groupObject = groupValue.GetObject();
                    DataGroup  group       = new DataGroup(groupObject["UniqueId"].GetString(),
                                                           groupObject["Title"].GetString(),
                                                           groupObject["Subtitle"].GetString(),
                                                           groupObject["ImagePath"].GetString(),
                                                           groupObject["MoreInfoText"].GetString(),
                                                           new Uri(groupObject["MoreInfoUri"].GetString()));

                    foreach (JsonValue itemValue in groupObject["Items"].GetArray())
                    {
                        JsonObject itemObject    = itemValue.GetObject();
                        JsonObject requestObject = itemObject["Request"].GetObject();

                        //Add the Authorization header with the access token.
                        JsonObject jsonHeaders = requestObject["Headers"].GetObject();
                        jsonHeaders["Authorization"] = JsonValue.CreateStringValue(jsonHeaders["Authorization"].GetString()
                                                                                   + accessToken);

                        // The body can be a JSON object or string, we need to
                        // determine the type of JSON value and use the right
                        // method to get the value.
                        string strBody;
                        if (requestObject["Body"].ValueType == JsonValueType.Object)
                        {
                            strBody = requestObject["Body"].GetObject().Stringify();
                        }
                        else if (requestObject["Body"].ValueType == JsonValueType.String)
                        {
                            strBody = requestObject["Body"].GetString();
                        }
                        else
                        {
                            throw new NotSupportedException("The body should only be of value JSON object or JSON string.");
                        }

                        //Create the request object
                        RequestItem request = new RequestItem(new Uri(requestObject["ApiUrl"].GetString(), UriKind.Relative),
                                                              requestObject["Method"].GetString(),
                                                              jsonHeaders,
                                                              strBody);

                        //Create the data item object
                        DataItem item = new DataItem(itemObject["UniqueId"].GetString(),
                                                     itemObject["Title"].GetString(),
                                                     itemObject["Subtitle"].GetString(),
                                                     itemObject["ImagePath"].GetString()
                                                     );

                        // Add the request object to the item
                        item.Request = request;

                        //Add the item to the group
                        group.Items.Add(item);
                    }
                    this.Groups.Add(group);
                }
            }
        }
        private async Task GetSampleDataAsync()
        {
            Uri dataUri = new Uri("ms-appx:///DataModel/InitialData.json"); 
            StorageFile file = await StorageFile.GetFileFromApplicationUriAsync(dataUri);
            string jsonText = await FileIO.ReadTextAsync(file);

            // Ensure that we have a valid access token before updating the data
            string accessToken = await AuthenticationHelper.EnsureAccessTokenAvailableAsync();

            lock (this.Groups)
            {
                if (this.Groups.Count != 0)
                    return;

                JsonObject jsonObject = JsonObject.Parse(jsonText);
                JsonArray jsonArray = jsonObject["Groups"].GetArray();

                foreach (JsonValue groupValue in jsonArray)
                {
                    JsonObject groupObject = groupValue.GetObject();
                    DataGroup group = new DataGroup(groupObject["UniqueId"].GetString(),
                                                                groupObject["Title"].GetString(),
                                                                groupObject["Subtitle"].GetString(),
                                                                groupObject["ImagePath"].GetString(),
                                                                groupObject["MoreInfoText"].GetString(),
                                                                new Uri(groupObject["MoreInfoUri"].GetString()));

                    foreach (JsonValue itemValue in groupObject["Items"].GetArray())
                    {
                        JsonObject itemObject = itemValue.GetObject();
                        JsonObject requestObject = itemObject["Request"].GetObject();

                        //Add the Authorization header with the access token.
                        JsonObject jsonHeaders = requestObject["Headers"].GetObject();
                        jsonHeaders["Authorization"] = JsonValue.CreateStringValue(jsonHeaders["Authorization"].GetString()
                            + accessToken);

                        // The body can be a JSON object or string, we need to 
                        // determine the type of JSON value and use the right 
                        // method to get the value.
                        string strBody;
                        if (requestObject["Body"].ValueType == JsonValueType.Object)
                        {
                            strBody = requestObject["Body"].GetObject().Stringify();
                        }
                        else if (requestObject["Body"].ValueType == JsonValueType.String)
                        {
                            strBody = requestObject["Body"].GetString();
                        }
                        else
                        {
                            throw new NotSupportedException("The body should only be of value JSON object or JSON string.");
                        }

                        //Create the request object
                        RequestItem request = new RequestItem(new Uri(requestObject["ApiUrl"].GetString(), UriKind.Relative),
                                                           requestObject["Method"].GetString(),
                                                           jsonHeaders,
                                                           strBody);

                        //Create the data item object
                        DataItem item = new DataItem(itemObject["UniqueId"].GetString(),
                                                           itemObject["Title"].GetString(),
                                                           itemObject["Subtitle"].GetString(),
                                                           itemObject["ImagePath"].GetString()
                                                           );

                        // Add the request object to the item
                        item.Request = request;

                        //Add the item to the group
                        group.Items.Add(item);
                    }
                    this.Groups.Add(group);
                }
            }
        }