Let's break this into two functions: insertIntoPartition and insertOverwritePartition