private int? GetGroupId(DeviceGroupManagementClient service, int? groupId)
{
int? foundGroupId = null;
try
{
DeviceGroup[] groups = service.GetChildGroups(groupId);
for (int i = 0; i < groups.Length; i++)
{
if (groups[i].Name == "Authorized Devices")
{
foundGroupId = GetGroupId(service, groups[i].Id);
break;
}
if (groups[i].Name == this.DeviceGroup)
{
foundGroupId = groups[i].Id;
break;
}
}
}
catch (Exception ex)
{
LogMessage(MessageImportance.High, "Error Retrieving Groups.");
LogMessage(MessageImportance.High, ex.ToString());
}
return foundGroupId;
}