Refactored Core Data functionality for Sync implementation.