Implementing __sleep() so entities are saved without errors.