Moved insert functionality in a separated private method