Implement APIs and process for managing site data

See #3, #4 
Pretty cool change_state method.  Is this defensive coding, or do you anticipate a definite need for the locking?  Also, I haven't looked at this yet, but when I ran the code just now, I got:

    select_for_update cannot be used outside of a transaction

That's interesting; is the connection winding up in autocommit mode somehow?