public Advert FindById(int id) { try { var ad = _advertRepository.FindById(id); if (ad == null) { throw new NotFoundException("Advert", id); } return(ad); } catch (NotFoundException e) { throw e; } catch (Exception e) { _logger.LogError("Exception at AdvertService.FindById method", id); throw new ApplicationException("An error occured when finding the advert.", e); } }