private async Task <dynamic> AddChildGroups(dynamic parameters) { try { var identityProvider = GetQueryParameter("identityProvider"); var tenantId = GetQueryParameter("tenantId"); GroupIdentifier groupIdentifier = CreateGroupIdentifier(SetIdentityProvider(identityProvider), tenantId, parameters.groupName.ToString()); var group = await _groupService.GetGroup(groupIdentifier); await CheckWriteAccess(group); var groupPostApiRequests = this.Bind <List <GroupPostApiRequest> >(); group = await _groupService.AddChildGroups(group, groupPostApiRequests.Select(g => { var g1 = g.ToGroupDomainModel(); g1.IdentityProvider = SetIdentityProvider(g1.IdentityProvider); return(g1); })); return(CreateSuccessfulPostResponse(group.Name, group.ToGroupRoleApiModel(), HttpStatusCode.OK)); } catch (NotFoundException <Group> ex) { return(CreateFailureResponse(ex.Message, HttpStatusCode.NotFound)); } catch (BadRequestException <Group> ex) { return(CreateFailureResponse(ex.Message, HttpStatusCode.BadRequest)); } catch (AlreadyExistsException <Group> ex) { return(CreateFailureResponse(ex.Message, HttpStatusCode.Conflict)); } }