Updated Model generator

Allowed model generator to cater for optional properties