Create and save main thread. Add insert.

These changes are not related to Reactive yet, just restructuring for
easier use of Core Data. Somewhat similar to MagicalRecord, in fact.