State replication framework