Move database row ops to db