Changed way of creating fk to support multiple instances in the db