refactored and fixed bug in foreach implementation
implemented Sequel::insert()