Changing the way to extract id for persistence