Could move `new Reasoning(repositoryId, ex.getMessage())` to the top of the method (as its the same for both branches) and then just add a block for when the exception is a `GroupItemNotFoundException`:
```
    final Reasoning result = new Reasoning(repositoryId, ex.getMessage());
    if (infex instanceof GroupItemNotFoundException) {
      final GroupItemNotFoundException ginfex = (GroupItemNotFoundException) ex;
      for (Entry<Repository, Throwable> memberReason : ginfex.getMemberReasons().entrySet()) {
        result.getMembers().add(buildReasoning(memberReason.getKey().getId(), memberReason.getValue()));
      }
    }
    return result;
```