Fixed the way of throwing EntityNotFoundException.