refactor the dropbox api code into model and controller