/// <summary>
 /// Intitalise multiple models and kick start oauth/sync
 /// </summary>
 /// <returns></returns>
 public ActionResult Index()
 {
     multiplemodels = new Multiplemodels();
     multiplemodels.SyncObjectsModel = new Syncdto();
     multiplemodels.OAuthorizationModel = new OAuthorizationdto();
     multiplemodels.TimeActivityModel = new TimeActivitydto();
     multiplemodels.IsReadySync = false;
     var oAuthModel = new OAuthService(multiplemodels.OAuthorizationModel).IsTokenAvailable(this);
     if (oAuthModel.IsConnected)
     {
         multiplemodels.IsReadySync = true;
         multiplemodels.OAuthorizationModel = oAuthModel;
         multiplemodels.IsConnected = oAuthModel.IsConnected;
         var syncService = new SyncService(oAuthModel);
         multiplemodels.SyncObjectsModel.OauthToken = oAuthModel;
         multiplemodels.SyncObjectsModel = syncService.IsEmpSync(multiplemodels.SyncObjectsModel, syncService);
         multiplemodels.SyncObjectsModel = syncService.IsCustSync(multiplemodels.SyncObjectsModel, syncService);
         multiplemodels.SyncObjectsModel = syncService.IsServiceItemSync(multiplemodels.SyncObjectsModel, syncService);
         multiplemodels.SyncObjectsModel.CompanyId = oAuthModel.Realmid;
         multiplemodels.SyncObjectsModel = syncRepo.Save(this, multiplemodels.SyncObjectsModel);
         multiplemodels.IsReadyTimeentry = multiplemodels.SyncObjectsModel.IsEmployeeSync || multiplemodels.SyncObjectsModel.IsCustomerSync || multiplemodels.SyncObjectsModel.IsServiceItemSync;
         multiplemodels.IsReadytoInvoice = false;
         return View(multiplemodels);
     }
     else
     {
         return View(multiplemodels);
     }
 }
 /// <summary>
 /// Sequence :
 /// -->Get Token
 /// -->Get data to be pushed to QBO
 /// -->Call the service
 /// 
 /// </summary>
 /// <param name="id"></param>
 /// <returns>RedirectToAction</returns>
 public ActionResult Employee(Int64 id)
 {
     OAuthorizationdto oAuthDetails = new OAuthService(new OAuthorizationdto()).GetAccessToken(this);
     syncService = new SyncService(oAuthDetails);
     syncObjects = id>0?syncService.GetSyncObjects(this,id):new  Syncdto();
     syncObjects.OauthToken = oAuthDetails;
     syncObjects.CompanyId = oAuthDetails.Realmid;
     
     if (!syncService.IsEmpSync(syncObjects, syncService).IsEmployeeSync)
     {
         syncObjects = syncService.GetDatafromDBEmployee(syncObjects);
         if (syncObjects.EmployeeList.Count>0)
         {
             syncObjects = syncService.SyncEmployees(this, syncObjects);
         }
     }
     return RedirectToAction("Sync", "Home", new { id = syncObjects.Id, isConnected = oAuthDetails.IsConnected });
 }