introduce DEntity.keySet method

and refactor DEntity.toMap in terms of keySet