public async Task<ActionResult> Index() {
      var accessToken = await AadHelper.GetAccessToken();
      var repo = new VideoChannelRepository(accessToken);

      var channels = await repo.GetChannels(false);

      return View(channels);
    }
    public async Task<ActionResult> Delete(string channelId, string videoId) {
      var accessToken = await AadHelper.GetAccessToken();
      var repo = new VideoChannelRepository(accessToken);

      if (channelId != null && videoId != null) {
        await repo.DeleteChannelVideo(channelId, videoId);
      }

      // if channelid provided, use this
      if (channelId != null) {
        return RedirectToRoute("ChannelVideos", new RouteValueDictionary(new { channelId = channelId, action = "Index" }));
      } else {
        return RedirectToRoute("Default", new { controller = "Channel", action = "Index" });
      }
    }
    public async Task<ActionResult> Index(string channelId) {
      var accessToken = await AadHelper.GetAccessToken();
      var repo = new VideoChannelRepository(accessToken);

      var channel = await repo.GetChannel(channelId);
      var videos = await repo.GetChannelVideos(channelId);

      var viewModel = new VideoListViewModel {
        ChannelId = channelId,
        ChannelTitle = channel.Title,
        Videos = videos
      };

      return View(viewModel);
    }
    public async Task<ActionResult> Create([Bind(Include = "ChannelId,Title,Description")] Video video, HttpPostedFileBase upload) {
      var accessToken = await AadHelper.GetAccessToken();
      var repo = new VideoChannelRepository(accessToken);

      // if a file is uploaded, add to video & upload
      if (upload != null && upload.ContentLength > 0) {
        video.FileName = upload.FileName;
        using (var reader = new System.IO.BinaryReader(upload.InputStream)) {
          video.FileContent = reader.ReadBytes(upload.ContentLength);
        }

        await repo.UploadVideo(video);
      }

      return RedirectToRoute("ChannelVideos", new RouteValueDictionary(new { channelId = video.ChannelId, action = "Index" }));
    }