private void btnAddNote_Click(object sender, RoutedEventArgs e)
        {
            #region Validation

            if (CurrentPhysicalPersonCardForm.Description == null)
            {
                MainWindow.ErrorMessage = ((string)Application.Current.FindResource("Opis"));
                return;
            }

            #endregion
            Thread th = new Thread(() =>
            {
                SubmitButtonEnabled = false;
                CurrentPhysicalPersonCardForm.PhysicalPerson = CurrentPhysicalPerson;

                CurrentPhysicalPersonCardForm.Company = new CompanyViewModel()
                {
                    Id = MainWindow.CurrentCompanyId
                };
                CurrentPhysicalPersonCardForm.CreatedBy = new UserViewModel()
                {
                    Id = MainWindow.CurrentUserId
                };

                new PhysicalPersonCardSQLiteRepository().Delete(CurrentPhysicalPersonCardForm.Identifier);

                var response = new PhysicalPersonCardSQLiteRepository().Create(CurrentPhysicalPersonCardForm);
                if (!response.Success)
                {
                    MainWindow.ErrorMessage = response.Message;

                    CurrentPhysicalPersonCardForm            = new PhysicalPersonCardViewModel();
                    CurrentPhysicalPersonCardForm.Identifier = Guid.NewGuid();
                    CurrentPhysicalPersonCardForm.ItemStatus = ItemStatus.Added;
                    CurrentPhysicalPersonCardForm.IsSynced   = false;

                    return;
                }

                CurrentPhysicalPersonCardForm            = new PhysicalPersonCardViewModel();
                CurrentPhysicalPersonCardForm.Identifier = Guid.NewGuid();
                CurrentPhysicalPersonCardForm.ItemStatus = ItemStatus.Added;
                CurrentPhysicalPersonCardForm.IsSynced   = false;

                PhysicalPersonCreatedUpdated();
                DisplayPhysicalPersonCardData();

                Application.Current.Dispatcher.BeginInvoke(
                    System.Windows.Threading.DispatcherPriority.Normal,
                    new Action(() =>
                {
                    txtNote.Focus();
                })
                    );
                SubmitButtonEnabled = true;
            });
            th.IsBackground = true;
            th.Start();
        }
        private void BtnDelete_Click(object sender, RoutedEventArgs e)
        {
            var response = new PhysicalPersonCardSQLiteRepository().SetStatusDeleted(CurrentPhysicalPersonCardDG.Identifier);

            if (response.Success)
            {
                MainWindow.SuccessMessage = ((string)Application.Current.FindResource("Stavka_je_uspešno_obrisanaUzvičnik"));

                CurrentPhysicalPersonCardForm            = new PhysicalPersonCardViewModel();
                CurrentPhysicalPersonCardForm.Identifier = Guid.NewGuid();
                CurrentPhysicalPersonCardForm.ItemStatus = ItemStatus.Added;

                CurrentPhysicalPersonCardDG = null;

                PhysicalPersonCreatedUpdated();

                Thread displayThread = new Thread(() => DisplayPhysicalPersonCardData());
                displayThread.IsBackground = true;
                displayThread.Start();
            }
            else
            {
                MainWindow.ErrorMessage = response.Message;
            }
        }
        public void DisplayPhysicalPersonCardData()
        {
            PhysicalPersonCardDataLoading = true;

            PhysicalPersonCardListResponse response = new PhysicalPersonCardSQLiteRepository()
                                                      .GetPhysicalPersonCardsByPhysicalPerson(MainWindow.CurrentCompanyId, CurrentPhysicalPerson.Identifier);

            if (response.Success)
            {
                PhysicalPersonCardsFromDB = new ObservableCollection <PhysicalPersonCardViewModel>(
                    response.PhysicalPersonCards ?? new List <PhysicalPersonCardViewModel>());
            }
            else
            {
                PhysicalPersonCardsFromDB = new ObservableCollection <PhysicalPersonCardViewModel>();
            }

            PhysicalPersonCardDataLoading = false;
        }