Clean old contract model
Add unique index to some entities