Fix HLint warning: Reduce duplication