Adding support for EntityState and EntityAttachMode