Move common code for checking if value is empty into function.
Move common code for checking if value is empty into function.

materials-commons/mcstore,materials-commons/mcstore,materials-commons/mcstore