Added a toArray method for converting transaction object to an array