public IHttpActionResult Postcat(CategoryVM cat)
        {
            bool catFlag = isAddedBefor(cat.Name);

            if (catFlag)
            {
                ModelState.AddModelError("cat", "Categoryl already exists");
            }
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            Category newcat = new API_Server.Category();

            newcat = ConvertClass.VMToCategory(cat);
            db.Categories.Add(newcat);
            db.SaveChanges();


            var catId =
                (from c in db.Categories
                 where c.Name == cat.Name
                 select c.Id).FirstOrDefault();

            return(Ok(catId));
        }