separated uploade to cloud and save to database logic