1. HandleMasterSync(sfApi,work);
1.1. toUpdaeStartId : Read().FirstOrDefault(); toUpdateEndId : db.Database.SqlQuery("Select @@DBTS").FirstOrDefault(); SyncUsers(sfAPi, work, toUpdateEndId, toUpdateStartId)
1.1.1. Updates/add users in salesforce between end and start dbts
1.2. UpdateLastSyncRun(toUpdateEndId);
2. Salesforce to CMS Sync
2.1. Inbound Messages
2.1.1. AccountColor SF Object : Account CMS Object : Office, OfficeParentGroup
2.1.1.1. HandleAccountColorSync()
2.1.1.1.1. Update Tab Color
2.1.2. Account SF Object : Account CMS Objects : Office, OfficeParentGroup )
2.1.2.1. HandleAccountSync()
2.1.2.1.1. IF Parent Account
2.1.2.1.2. IF Normal Account
2.1.2.1.3. IF Billing Parent Account
2.1.3. Contact SF Object : Contact CMS Object : Users
2.1.3.1. Check if salesforce parent account for this contact is povisioend
2.1.3.1.1. True
2.1.3.1.2. False
2.1.4. Device SF Object : DeviceType__C CMS Object : DeviceTypes
2.1.4.1. Device type sync
2.1.5. Officelocation SF Object : Office_Location__c
2.1.5.1. Put OfficeLocation
2.1.5.1.1. Office Location Mapping
2.1.6. Plan SF Object : Plan__c CMS Object : AccessPlan
2.1.6.1. Update Access Plan
2.1.6.1.1. Access Plan fields Mapping
2.1.7. RecordsForDeletionInCMS SF Object : CMS Object : Users,OfficeRestDetail
2.1.7.1. handle Contact Delete
2.1.7.2. handle Rest Key delete
2.1.8. RestKey1 SF Object : Rest_Key__c CMS Object : OfficeRestDetail
2.1.8.1. handle Rest Key sync
3. CMS to Salesforce Sync
4. CMS to Salesforce Data Migration
5. XERO
5.1. SF to XERO
5.1.1. Opportunity is Created/Updated
5.1.1.1. Check if opportunity's Account Exists in XERO Contacts
5.1.1.1.1. Yes
5.1.1.1.2. No
5.2. XERO to SF
5.2.1. Trigger: Runs Automatically every 2 mins
5.2.1.1. Get list of Update/Created xero invoices in last 2 mins
5.2.1.1.1. Update salesforce opportunities