Refactored entities model
Added sql scripts