cleaning db and paginate controller element