void validateSelectedItem(bool setCurrent) { var controller = controllers[selectedIndex]; controller.ValidateName(); var newProfileName = controller.GetEditValue(); if (setCurrent && controller.ProfileName == newProfileName) // it is a set { FoveManager.SetCurrentProfile(newProfileName); } else if (string.IsNullOrEmpty(controller.ProfileName)) // create case { FoveManager.CreateProfile(newProfileName); } else { FoveManager.RenameProfile(controller.ProfileName, newProfileName); } controller.ProfileName = newProfileName; }