public async Task <CPFeed> MyBlogs(int page)
        {
            var loginToken = Settings.AuthLoginToken;

            if (!string.IsNullOrEmpty(loginToken))
            {
                using (var client = new HttpClient())
                {
                    client.BaseAddress = new Uri(baseUrl);
                    client.DefaultRequestHeaders.Accept.Clear();
                    client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

                    // Add the Authorization header with the AccessToken.
                    client.DefaultRequestHeaders.Add("Authorization", "Bearer " + loginToken);

                    // create the URL string.
                    string url = string.Format("v1/My/blogposts?page={0}", page);

                    // make the request
                    HttpResponseMessage response = await client.GetAsync(url);

                    // parse the response and return the data.
                    string jsonString = await response.Content.ReadAsStringAsync();

                    CPFeed responseData = JsonHelper.Deserialize <CPFeed>(jsonString);
                    await BlobCache.LocalMachine.InsertObject <CPFeed>("MyBlogs", responseData, DateTimeOffset.Now.AddDays(3));

                    return(responseData);
                }
            }
            else
            {
                return(null);
            }
        }
        public async Task <CPFeed> GetArticleAsync(int page, int cveCategoria)
        {
            //if (!initialized)
            //    await Init();
            //var accessToken = Settings.AuthToken;

            //if (!string.IsNullOrEmpty(accessToken))
            //{

            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri(baseUrl);
                client.DefaultRequestHeaders.Accept.Clear();
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

                // Add the Authorization header with the AccessToken.
                client.DefaultRequestHeaders.Add("Authorization", "Bearer ");

                // create the URL string.
                string url = string.Format("api/tblnoticias/categoria/{0}", cveCategoria);

                // make the request
                HttpResponseMessage response = await client.GetAsync(url);

                // parse the response and return the data.
                string jsonString = await response.Content.ReadAsStringAsync();

                string jsonArmado = "{'items':" + jsonString + "}";

                CPFeed responseData = JsonHelper.Deserialize <CPFeed>(jsonArmado);                    Debug.WriteLine(responseData);
                //await BlobCache.LocalMachine.InsertObject<CPFeed>("DefaultArticle", responseData, DateTimeOffset.Now.AddDays(1));
                return(responseData);
            }
            //}
            //else
            //{
            //    Init();
            //    return null;
            //}
        }
        private async Task ExecuteGetAuthorDataCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            GetAuthorDataCommand.ChangeCanExecute();

            try
            {
                CPFeed authorDataFeed = null;
                switch (authorDataType)
                {
                case AuthorDataType.Article:
                {
                    authorDataFeed = await BlobCache.LocalMachine.GetOrFetchObject <CPFeed>("MyArticle",
                                                                                            async() => await cpFeed.MyArticles(1),
                                                                                            DateTimeOffset.Now.AddDays(3)
                                                                                            );

                    // I dont like this but let it be
                    await BlobCache.LocalMachine.InsertObject <string>("AuthorArticles", authorDataFeed.pagination.totalItems.ToString(), DateTimeOffset.Now.AddDays(3));

                    break;
                }

                case AuthorDataType.Message:
                {
                    authorDataFeed = await BlobCache.LocalMachine.GetOrFetchObject <CPFeed>("MyMessage",
                                                                                            async() => await cpFeed.MyMessage(1),
                                                                                            DateTimeOffset.Now.AddDays(3)
                                                                                            );

                    await BlobCache.LocalMachine.InsertObject <string>("AuthorMessages", authorDataFeed.pagination.totalItems.ToString(), DateTimeOffset.Now.AddDays(3));

                    break;
                }

                case AuthorDataType.Comments:
                {
                    authorDataFeed = await BlobCache.LocalMachine.GetOrFetchObject <CPFeed>("MyComments",
                                                                                            async() => await cpFeed.MyComments(1),
                                                                                            DateTimeOffset.Now.AddDays(3)
                                                                                            );

                    await BlobCache.LocalMachine.InsertObject <string>("AuthorComments", authorDataFeed.pagination.totalItems.ToString(), DateTimeOffset.Now.AddDays(3));

                    break;
                }

                case AuthorDataType.Tips:
                {
                    authorDataFeed = await BlobCache.LocalMachine.GetOrFetchObject <CPFeed>("MyTips",
                                                                                            async() => await cpFeed.MyTips(1),
                                                                                            DateTimeOffset.Now.AddDays(3)
                                                                                            );

                    await BlobCache.LocalMachine.InsertObject <string>("AuthorTips", authorDataFeed.pagination.totalItems.ToString(), DateTimeOffset.Now.AddDays(3));

                    break;
                }

                case AuthorDataType.TechBlog:
                {
                    authorDataFeed = await BlobCache.LocalMachine.GetOrFetchObject <CPFeed>("MyBlogs",
                                                                                            async() => await cpFeed.MyBlogs(1),
                                                                                            DateTimeOffset.Now.AddDays(3)
                                                                                            );

                    await BlobCache.LocalMachine.InsertObject <string>("AuthorBlogs", authorDataFeed.pagination.totalItems.ToString(), DateTimeOffset.Now.AddDays(3));

                    break;
                }
                }

                foreach (var article in authorDataFeed.items)
                {
                    AutorItems.Add(article);
                }
                IsBusy = false;
            }
            catch (Exception ex)
            {
            }
        }