public bool SaveAll(List <Models.Post> posts)
 {
     try
     {
         var path = HttpContext.Current.Server.MapPath("~/App_Data/blog-Posts.json");
         if (!File.Exists(path))
         {
             File.Create(path);
         }
         File.WriteAllText(path, CommonConverter.SerializeObject(new { blogPosts = posts.ToArray() }));
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
 public bool Add(Models.Post post)
 {
     try
     {
         var path = HttpContext.Current.Server.MapPath("~/App_Data/blog-Posts.json");
         if (!File.Exists(path))
         {
             File.Create(path);
         }
         List <Models.Post> posts = GetAll();
         if (posts == null)
         {
             posts = new List <Models.Post>();
         }
         post.ID = posts.Max(p => p.ID) + 1;
         posts.Add(post);
         File.WriteAllText(path, CommonConverter.SerializeObject(new { blogPosts = posts.ToArray() }));
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }