Add database logic to Home view