class ChangePrimaryGatewayService {

    public Optional<String> getPrimaryGatewayInstanceId(Stack stack) {
        Optional<String> primaryGatewayInstanceId = Optional.empty();
        try {
            primaryGatewayInstanceId = Optional.of(gatewayConfigService.getPrimaryGatewayConfig(stack).getInstanceId());
        } catch (NotFoundException e) {
            LOGGER.debug("No active primary gateway found");
        }
        return primaryGatewayInstanceId;
    }

}