/// <summary>
        /// Deletes related record.
        /// </summary>
        private async void DeleteButton_Click(object sender, RoutedEventArgs e)
        {
            if (RelatedRecords.SelectedItem == null)
            {
                return;
            }
            var    graphic = (Graphic)RelatedRecords.SelectedItem;
            string message = null;

            try
            {
                if (table == null)
                {
                    table = await GetRelatedTableAsync();
                }
                var featureID = Convert.ToInt64(graphic.Attributes[table.ObjectIDField], CultureInfo.InvariantCulture);
                await table.DeleteAsync(featureID);
                await SaveEditsAsync();
                await QueryRelatedRecordsAsync();

                SetAttributeEditor();
            }
            catch (Exception ex)
            {
                message = ex.Message;
            }
            if (!string.IsNullOrWhiteSpace(message))
            {
                await new MessageDialog(message).ShowAsync();
            }
        }