implemented fromArray() and toArray() methods on product model