refactorise db methods. fix bug adding divesite when edit