public Alarm Get(int id, User user) { IFilter <Alarm> filter = new AlarmFilter(); if (user != null) { filter = new IdentityAlarmFilter(filter, user); } Alarm alarm = alarmRepository.GetById(id, filter); if (alarm == null) { throw new NotFoundException(typeof(Alarm)); } return(alarm); }