Fix AttributeError when serializing transactions with null categories.
The to_representation method now checks for None before accessing
category properties, returning None instead of crashing.
Fixes issue where API returns 500 error when retrieving transactions
without assigned categories.