Implement database insertion.
Remove unused imports and members.