public IHttpActionResult PutCustomPage(int id, [FromBody] CustomPageDTO page)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (string.IsNullOrEmpty(page.Name) || string.IsNullOrEmpty(page.Body) || string.IsNullOrEmpty(page.Title))
            {
                return(BadRequest("Either name or body or title is missing."));
            }

            try
            {
                CustomPage cp = db.CustomPages.FirstOrDefault(t => t.ID == id);
                cp.Head            = page.Head;
                cp.Name            = page.Name;
                cp.NoTemplate      = page.NoTemplate;
                cp.PageMeta        = page.PageMeta;
                cp.Sitemap         = page.Sitemap;
                cp.Status          = page.Status;
                cp.Title           = page.Title;
                cp.Body            = page.Body;
                cp.DateModified    = DateTime.Now;
                cp.ModifiedBy      = db.Members.FirstOrDefault(d => d.Email == User.Identity.Name);
                db.Entry(cp).State = EntityState.Modified;
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CustomPageExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(Ok());
        }
        public IHttpActionResult PostCustomPage([FromBody] CustomPageDTO page)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (string.IsNullOrEmpty(page.Name) || string.IsNullOrEmpty(page.Body) || string.IsNullOrEmpty(page.Title))
            {
                return(BadRequest("Either name or body or title is missing."));
            }
            if (db.CustomPages.Count(t => t.Name.Trim() == page.Name.Trim()) == 0)
            {
                CustomPage cp = new CustomPage()
                {
                    Body        = page.Body,
                    CreatedBy   = db.Members.FirstOrDefault(d => d.Email == User.Identity.Name),
                    DateCreated = DateTime.Now,
                    Head        = page.Head,
                    Name        = page.Name,
                    NoTemplate  = page.NoTemplate,
                    PageMeta    = page.PageMeta,
                    Sitemap     = page.Sitemap,
                    Status      = page.Status,
                    Title       = page.Title
                };
                db.CustomPages.Add(cp);
                db.SaveChanges();

                return(CreatedAtRoute("DefaultApi", new { id = cp.ID }, cp));
            }
            else
            {
                return(BadRequest("Page with same name exist."));
            }
        }