[WiP] Building the adapters into records

This should clean the code of the record quite a lot and make it more
stable.
[WiP] Overworking the database

This commit is broken too. But the code is starting to look much
cleaner now.