/// <summary>
        /// Exports a batch of entries to the database
        /// </summary>
        /// <param name="csentries">A list of changes to export</param>
        /// <returns>The results of the batch export</returns>
        PutExportEntriesResults IMAExtensible2CallExport.PutExportEntries(IList <CSEntryChange> csentries)
        {
            PutExportEntriesResults exportEntriesResults = new PutExportEntriesResults();

            foreach (CSEntryChange csentry in csentries)
            {
                try
                {
                    List <AttributeChange> anchorchanges = new List <AttributeChange>();
                    bool referenceRetryRequired;
                    anchorchanges.AddRange(CSEntryExport.PutExportEntry(csentry, out referenceRetryRequired));

                    if (referenceRetryRequired)
                    {
                        Logger.WriteLine(string.Format("Reference attribute not available for csentry {0}. Flagging for retry", csentry.DN));
                        exportEntriesResults.CSEntryChangeResults.Add(CSEntryChangeResult.Create(csentry.Identifier, anchorchanges, MAExportError.ExportActionRetryReferenceAttribute));
                    }
                    else
                    {
                        exportEntriesResults.CSEntryChangeResults.Add(CSEntryChangeResult.Create(csentry.Identifier, anchorchanges, MAExportError.Success));
                    }
                }
                catch (Exception ex)
                {
                    if (exportEntriesResults.CSEntryChangeResults.Contains(csentry.Identifier))
                    {
                        exportEntriesResults.CSEntryChangeResults.Remove(csentry.Identifier);
                    }

                    exportEntriesResults.CSEntryChangeResults.Add(this.GetExportChangeResultFromException(csentry, ex));
                }
            }

            return(exportEntriesResults);
        }
        /// <summary>
        /// Exports a single entry
        /// </summary>
        /// <param name="csentry">The entry to export</param>
        /// <param name="referenceRetryRequired">A value indicating whether the export need to be retried as one of more referenced objects were not present</param>
        /// <returns>A list of anchor attributes if the object was added to the target system, otherwise returns an empty list</returns>
        public static List <AttributeChange> PutExportEntry(CSEntryChange csentry, out bool referenceRetryRequired)
        {
            List <AttributeChange> anchorchanges = new List <AttributeChange>();

            referenceRetryRequired = false;

            switch (csentry.ObjectModificationType)
            {
            case ObjectModificationType.Add:
                anchorchanges.Add(AttributeChange.CreateAttributeAdd("entry-dn", csentry.DN));
                CSEntryExport.PerformCSEntryExportAdd(csentry);
                break;

            case ObjectModificationType.Delete:
                CSEntryExport.PerformCSEntryExportDelete(csentry);
                break;

            case ObjectModificationType.None:
                break;

            case ObjectModificationType.Update:
            case ObjectModificationType.Replace:
                CSEntryExport.PerformCSEntryExportUpdate(csentry);
                string newDN = GetNewDN(csentry);

                if (newDN != null)
                {
                    anchorchanges.Add(AttributeChange.CreateAttributeReplace("entry-dn", newDN));
                }

                break;

            case ObjectModificationType.Unconfigured:
                throw new InvalidOperationException("The object modification type 'unconfigured' is not supported for this object type");

            default:
                throw new InvalidOperationException("The object modification type is unknown");
            }

            return(anchorchanges);
        }