public async Task<IEnumerable<Notebook>> GetNotebooks()
        {
            // ensure connection established to new onenote API
            if ((string.IsNullOrEmpty(_oneNoteEndpoint)) ||
                (string.IsNullOrEmpty(_oneNoteResourceId)))
            {
                await InitOneNoteRestConnection();
            }

            // create query
            var query = _oneNoteEndpoint + "/me/notes/notebooks";

            // create request
            var request = new HttpRequestMessage(HttpMethod.Get, query);

            // issue request & get response
            var response = await _client.SendAsync(request);
            string responseString = await response.Content.ReadAsStringAsync();
            var jsonResponse = JsonConvert.DeserializeObject<JsonHelpers.NotebooksJson>(responseString);

            // convert to model object
            var notebooks = new List<Notebook>();
            foreach (var notebook in jsonResponse.Notebooks)
            {
                var item = new Notebook
                {
                    Id = notebook.Id,
                    Name = notebook.Name,
                    NotebookUrl = notebook.NotebookUrl,
                    IsDefault = notebook.IsDefault,
                    CreatedDateTime = notebook.CreatedTime,
                    LastModifiedDateTime = notebook.LastModifiedTime,
                    SectionsUrl = notebook.SectionsUrl,
                    SectionGroupsUrl = notebook.SectionGroupsUrl,
                    ClientUrl = notebook.Links.OneNoteClientUrl.href,
                    WebUrl = notebook.Links.OneNoteWebUrl.href
                };

                notebooks.Add(item);
            }

            return notebooks.OrderBy(n => n.Name).ToList();
        }
    public async Task<Notebook> GetNotebook(string notebookid) {
      // ensure connection established to new onenote API
      if ((string.IsNullOrEmpty(_oneNoteEndpoint)) ||
          (string.IsNullOrEmpty(_oneNoteResourceId))) {
        await InitOneNoteRestConnection();
      }

      // create query
      var query = string.Format("{0}/me/notes/notebooks/?$top=1&$filter=id eq '{1}'", _oneNoteEndpoint, notebookid);

      // create request
      var request = new HttpRequestMessage(HttpMethod.Get, query);

      // issue request & get response
      var response = await _client.SendAsync(request);
      string responseString = await response.Content.ReadAsStringAsync();
      var jsonResponse = JsonConvert.DeserializeObject<JsonHelpers.NotebooksJson>(responseString).Notebooks[0];

      // convert to model object
      var notebook = new Notebook {
        Id = jsonResponse.Id,
        Name = jsonResponse.Name,
        NotebookUrl = jsonResponse.NotebookUrl,
        IsDefault = jsonResponse.IsDefault,
        CreatedDateTime = jsonResponse.CreatedTime,
        LastModifiedDateTime = jsonResponse.LastModifiedTime,
        SectionsUrl = jsonResponse.SectionsUrl,
        SectionGroupsUrl = jsonResponse.SectionGroupsUrl,
        ClientUrl = jsonResponse.Links.OneNoteClientUrl.href,
        WebUrl = jsonResponse.Links.OneNoteWebUrl.href
      };

      return notebook;
    }
    public async Task<Notebook> GetNotebookPages(Notebook notebook, string sectionid) {
      // ensure connection established to new onenote API
      if ((string.IsNullOrEmpty(_oneNoteEndpoint)) ||
          (string.IsNullOrEmpty(_oneNoteResourceId))) {
        await InitOneNoteRestConnection();
      }

      HttpRequestMessage request = null;
      HttpResponseMessage response = null;
      string responseString;

      // for the specified section...
      var section = notebook.Sections.First(s => s.Id == sectionid);

      // get all the pages in the section
      request = new HttpRequestMessage(HttpMethod.Get, section.PagesUrl);
      response = await _client.SendAsync(request);
      
      // convert to JSON object
      responseString = await response.Content.ReadAsStringAsync();
      var jsonPages = JsonConvert.DeserializeObject<JsonHelpers.PagesJson>(responseString);

      // loop through all pages
      foreach (var jsonPage in jsonPages.Pages) {
        // convert pages to model objects
        var page = new NotePage {
          Id = jsonPage.Id,
          Name = jsonPage.Title,
          CreatedDateTime = jsonPage.CreatedTime,
          LastModifiedDateTime = jsonPage.LastModifiedTime,
          PageUrl = jsonPage.PageUrl,
          ClientUrl = jsonPage.Links.OneNoteClientUrl.href,
          WebUrl = jsonPage.Links.OneNoteWebUrl.href,
          ContentUrl = jsonPage.ContentUrl
        };

        // get the body of the page
        request = new HttpRequestMessage(HttpMethod.Get, page.ContentUrl);
        response = await _client.SendAsync(request);
        page.Content = await response.Content.ReadAsStringAsync();

        // add page to section
        section.Pages.Add(page);
      }

      return notebook;
    }
    public async Task<Notebook> GetNotebookSections(Notebook notebook) {
      // ensure connection established to new onenote API
      if ((string.IsNullOrEmpty(_oneNoteEndpoint)) ||
          (string.IsNullOrEmpty(_oneNoteResourceId))) {
        await InitOneNoteRestConnection();
      }

      // create query
      var query = notebook.SectionsUrl;

      // create request
      var request = new HttpRequestMessage(HttpMethod.Get, query);

      // issue request & get response
      var response = await _client.SendAsync(request);
      string responseString = await response.Content.ReadAsStringAsync();
      var jsonResponse = JsonConvert.DeserializeObject<JsonHelpers.SectionsJson>(responseString);

      // convert to model object
      foreach (var item in jsonResponse.Sections) {
        var section = new Section {
          Id = item.Id,
          Name = item.Name,
          CreatedDateTime = item.CreatedTime,
          LastModifiedDateTime = item.LastModifiedTime,
          PagesUrl = item.PagesUrl
        };
        notebook.Sections.Add(section);
      }

      return notebook;
    }