class SubscriptionService {

    public Subscription getSubscription(String alarmId, String subscriptionId) {
        Alarm c = seyrenRepository.getAlarm(alarmId);

        Subscription ret = c.getSubscriptions().stream().filter(s -> s.getId().equals(subscriptionId)).findAny().orElse(null);

        if (ret == null) {
            LOGGER.debug("Subscription {} for alarm {} does not exist.", subscriptionId, alarmId);
            throw new CerebroException(ErrorCode.SUBSCRIPTION_UNKNOWN,
                "Subscription " + subscriptionId + " for alarm " + alarmId + " does not exist.");
        }

        return ret;
    }

}