Move db connection stuff to the repository