Add purchase model.

And rearange some relations to be more flexible.
Also add some validations.