public ManageCleanTitle()
 {
     try
     {
         InitializeComponent();
         DataContext = CleanTitleServices.GetAll();
     }
     catch (Exception ex)
     {
         CatchException(ex);
     }
 }
        private void cmdSave_Click(object sender, RoutedEventArgs e)
        {
            Cursor = Cursors.Wait;

            IList <CleanTitle> objSource = CleanTitleServices.GetAll();
            IList <CleanTitle> objTarget = (IList <CleanTitle>)dtgData.DataContext;

            foreach (CleanTitle item in objSource)
            {
                if (!objTarget.Contains(item))
                {
                    CleanTitleServices.Delete(item);
                }
            }
            foreach (CleanTitle item in objTarget)
            {
                if (!objSource.Contains(item))
                {
                    CleanTitleServices.Add(item);
                }
            }
            Close();
        }