Abstracting the db interaction into a separate class, in a bid to move it out of the controller