public async Task <IEnumerable <GroupsVM> > GetAllGroups(CredentialVM credentialVm) { var list = new List <GroupsVM>(); var Credential = new UserData { SecretId = credentialVm.SecretId, TenantId = credentialVm.TenantId, ApplicationId = credentialVm.ApplicationId }; var Result = await _powerService.GetAllGroups(Credential); Result.ForEach(s => { list.Add(new GroupsVM { GroupId = s.Id, GroupName = s.Name }); }); return(list.ToArray()); }