Moved database logic to specific class