public ActionResult New(UnitCategoryForm form)
        {
            Debug.WriteLine(string.Format("POST: Unit Category Controller: New - gameID={0}", GameState.GameID));
            var game = GameState.Game;

            DB_unit_categories category = new DB_unit_categories();

            category.game_id     = game.Info.id;
            category.name        = form.Name;
            category.build_rate  = form.BuildRate;
            category.is_military = form.IsMilitary;
            Database.Session.Save(category);

            Database.Session.Flush();
            return(RedirectToRoute("Statistics"));
        }
        public ActionResult Edit(UnitCategoryForm form)
        {
            Debug.WriteLine(string.Format("POST: Unit Category Controller: Edit - unitCategoryID={0}", form.ID));
            var game = GameState.Game;

            var category = game.GameStatistics.UnitCategoriesRaw.Find(x => x.id == form.ID);

            if (category.game_id == null || category.game_id != game.Info.id)
            {
                return(RedirectToRoute("game", new { gameID = game.Info.id }));
            }

            category.name        = form.Name;
            category.build_rate  = form.BuildRate;
            category.is_military = form.IsMilitary;
            Database.Session.Update(category);

            Database.Session.Flush();
            return(RedirectToRoute("Statistics"));
        }