Replacing principal id with principal object