SQL backend for state.

Active/Active possibility by moving state to SQL.