Add support for recursive toArray() calls in abstract entity