refactor flickr api database sync