Separate out the logic of accessing the database from the logic that
the different states use. Do this by creating a set of interfaces
for each of the state handlers and then use different implementations
to get access the database.