Refactor out code that did non-empty validation

Change-Id: Ibea715f26cc3a2602a109ff46519e4806eaf4f23
Merge "Refactor out code that did non-empty validation"