We were triggering an assertion when trying to copy a private record
to a buffer for modifying. Extend the private type detection and
copy the contents after we have rejected invalid private records.
Closes #5857
Merge branch '5857-properly-detect-private-records-before-copying' into 'main'