public IActionResult GetCommandersGroups(string cmdrName) { if (string.IsNullOrWhiteSpace(cmdrName)) { return(NotFound()); } var existingGroups = _groupRepoz.GetByCommander(cmdrName).ToList(); if (existingGroups.Any()) { return(Ok(existingGroups)); } var defaultGroup = _groupRepoz.GetDefaultGroup(); _groupRepoz.AddCommanderToGroup(defaultGroup, cmdrName); return(Ok(new List <Group> { defaultGroup })); }