It probably makes sense to adjust this function to take the principal instead of the principal id. That should allow us to do proper checks instead of `hasOwnProperty` checks.