Fixed Identity Map to be generic

* Added a key to differentiate the class.
* Simplified identity map handling in the domain mapper.