Move duplicated sql code into helper
Have API calls use sql helper
Have bitmessageqt use sql helpers