internal object ParseEntityQueryResponse(EntityQueryBuilder schema)
        {
            var sampleDataSet = new DataSet { Locale = CultureInfo.InvariantCulture };
            DataTable output = sampleDataSet.Tables.Add("Entity");

            SetTableColumnsFromSchema(schema, output);

            output.Columns.Add("Mark for Deletion", typeof (bool));

            foreach (var response in _response.Entities)
            {
                var row = output.NewRow();

                ParseResponseUsingSchema(schema, row, response);
                row["Mark for Deletion"] = true;
                output.Rows.Add(row);
            }

            output.AcceptChanges();
            return output;
        }
        private void QueryRecords()
        {
            WorkAsync("Querying Records for Selected Rows from Step 4",
                e => // Work To Do Asynchronously
                {
                    var fetchXmlBuilder = new EntityQueryBuilder();
                    var formEntryReader = new FormEntryReader(fetchXmlBuilder);
                    formEntryReader.ReadEntitySelected(entityDropdown);
                    formEntryReader.ReadUniqueIdentifierAttributes(entityAttributeView);
                    formEntryReader.ReadFilterValuesFromSelectedRow(duplicatesGrid);
                    formEntryReader.ReadDisplayAttributes(entityAttributeView);
                    var response = GetRecordsFromCrm(fetchXmlBuilder.GetOutput());

                    var reader = new FetchXmlResponseReader(response);
                    var dataset = reader.ParseEntityQueryResponse(fetchXmlBuilder);
                    SafeSetDataSource(entityRecordGrid, dataset);

                    e.Result = "Step 5 Record View Updated";
                }, e => MessageBox.Show(e.Result as string));
        }