move server and database insertion code inside sync adapter class