// GET: Cluster Create
        public ActionResult Create()
        {
            Cluster newCluster = new Cluster();

            ViewBag.ClusterGroups = _clusterGroupSvc.GetList();
            return(View(newCluster));
        }
        public ActionResult Create(ClusterGroup clusterGroup)
        {
            if (ModelState.IsValid)
            {
                bool clustedExists = _clusterGroupSvc.GetList().Any(t => t.Name.Equals(clusterGroup.Name, StringComparison.CurrentCultureIgnoreCase));

                if (!clustedExists)
                {
                    if (clusterGroup.Id == 0)
                    {
                        _clusterGroupSvc.Create(clusterGroup);
                    }
                    else
                    {
                        _clusterGroupSvc.Update(clusterGroup);
                    }

                    return(View("List", _clusterGroupSvc.GetList().Select(CreateViewModel)));
                }
                else
                {
                    ModelState.AddModelError("Name", string.Format("The name '{0}' is already in use.", clusterGroup.Name));
                }
            }

            ViewBag.ClusterGroups = _clusterGroupSvc.GetList();

            return(View(clusterGroup));
        }