public ActionResult PostFeedConfig(FeedConfigModel m)
    {
      if (m.SelectedId == null)
        ModelState.AddModelError("selectedId", "You must select a collection from the list.");

      if (!ModelState.IsValidField("count")) ModelState.AddModelError("count", "Please enter a valid number for the count.");
      if (!ModelState.IsValidField("title")) ModelState.AddModelError("title", "Please enter a valid title.");

      if (ModelState.IsValid)
      {
        var appSvc = AppServiceRepository.GetService();
        var include = appSvc.GetInclude<FeedInclude>(m.IncludePath);
        include.Id = m.SelectedId;
        include.Title = string.IsNullOrEmpty(m.Title) || m.Title.Trim().Length == 0 ? null : m.Title.Trim();
        include.Count = m.Count;
        AppServiceRepository.UpdateService(appSvc);
        return Json(new { success = true, includePath = m.IncludePath });
      }
      LoadFeedConfig(m);
      return PartialView("WidgetFeedConfig", m);
    }
    private void LoadFeedConfig(FeedConfigModel m)
    {
      var scopes = AuthorizeService.GetScopes(this.User.Identity as User);

      m.Collections = scopes.Where(s => s.IsCollection)
        .Select(s => AppService.GetCollection(s.Workspace, s.Collection));
    }
 public ActionResult FeedConfig(FeedConfigModel m)
 {
   if (m.IncludePath != null)
   {
     var include = AppService.GetInclude<FeedInclude>(m.IncludePath);
     m.SelectedId = include.Id == null ? null : include.Id.ToString();
     m.Count = include.Count;
     m.Title = include.Title;
   }
   LoadFeedConfig(m);
   return PartialView("WidgetFeedConfig", m);
 }