Refactor ticket creation API. Refactor Db and others [cowboy].