Updated model to solve forgein key issues