Revise database to unify the usage of ID.

No more split server and client side IDs. The ID is only issued on
one side only and synced to other side.