Added unique constraints and got events api call working