Maybe this check can be extracted to into a method to make it more clear?