public ScheduleItemDto GetByIdWithDetails(int item_id) { try { var scheduleItem = _repository.GetByIdWithDetails(item_id); if (scheduleItem == null) { _logger.LogError($"ScheduleItem with id: {item_id}, hasn't been found in db."); return(null); } _logger.LogInfo($"Returned ScheduleItem with id: {item_id}"); var Result = _mapper.Map <ScheduleItemDto>(scheduleItem); return(Result); } catch (Exception ex) { _logger.LogError($"Something went wrong inside GetByIdWithDetails action: {ex.Message}"); throw new Exception(); } }