DRY up the property setting code by using macro for repeated pattern