add toArray method to abstract entity