private ActionResult AuthenticationCallback()
        {
            Session[EXACT_AUTH_STATE] = client.ProcessUserAuthorization(this.Request);

            // Call ExactOnline SDK
            ExactOnlineClient exact = new ExactOnlineClient(ConfigurationManager.AppSettings["exactOnlineUrl"], AccessTokenManager);

            UserLogin token = Session[DropboxController.DROPBOX_ACCESS_TOKEN] as UserLogin;

            List <DocumentCategory> categories = exact.For <DocumentCategory>().Select(new string[] { "ID", "Description" }).Get();

            Dropbox dropbox = new Dropbox(token, true);
            IEnumerable <string>      fileNames     = dropbox.GetNewDocumentNames();
            Dictionary <Guid, string> newReferences = new Dictionary <Guid, string>();

            foreach (string fileName in fileNames)
            {
                byte[] file = dropbox.GetFileBytes(fileName);
                string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(fileName);

                Document document = new Document()
                {
                    Subject      = fileNameWithoutExtension,
                    Body         = fileNameWithoutExtension,
                    Type         = 55,
                    DocumentDate = DateTime.Now.Date,
                    Category     = categories[3].ID
                };

                bool createdDocument = exact.For <Document>().Insert(ref document);

                DocumentAttachment attachment = new DocumentAttachment()
                {
                    Document   = document.ID,
                    FileName   = fileName,
                    FileSize   = (double)file.Length,
                    Attachment = file
                };

                bool createdAttachment = exact.For <DocumentAttachment>().Insert(ref attachment);

                newReferences.Add(document.ID, fileName);
            }

            Dictionary <Guid, string> existingReferences = dropbox.GetExactOnlineReferences();

            dropbox.UpdateExactOnlineReferences(existingReferences, newReferences);

            return(View());
            // Later, if necessary:
            // bool success = client.RefreshAuthorization(auth);
        }