Add statemachine for Documents