added database relations and validations to models