Add support for different idAttribute

This simplifies the logic and also allows you to use a different idAttribute other than 'id'.
Merge pull request #1 from brycekahle/patch-1

Add support for different idAttribute