Added direct partition insert, common code

More common code for hash partitioning added