Adding support for arrays in model

This is a crude implementation and requires more tests.