Support for custom pk fields

The previous implementation assumed that 'id' was the pk field. Manager utils takes out this assumption everywhere