Return record if passed as key to fetchByPrimary

Signed-off-by: Tom Wright <tom@inflatablecookie.com>
Fixed html entities in toText helper

Signed-off-by: Tom Wright <tom@inflatablecookie.com>