Cache some of the sql statements for performance. Short cut database checks when state isn't going to change.