/// <summary>
        /// Deactivate business partner by id
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public IndividualResponse Delete(int id)
        {
            IndividualResponse response = new IndividualResponse();

            try
            {
                Individual deletedIndividual = unitOfWork.GetIndividualsRepository().Delete(id);
                unitOfWork.Save();

                response.Individual = deletedIndividual.ConvertToIndividualViewModel();

                //Thread td = new Thread(() =>
                //{
                //    var resp = FirebaseHelper.Send<IndividualViewModel>("Individuals", response.Individual);
                //});
                //td.IsBackground = true;
                //td.Start();

                response.Success = true;
            }
            catch (Exception ex)
            {
                response.Individual = new IndividualViewModel();
                response.Success    = false;
                response.Message    = ex.Message;
            }

            return(response);
        }
        /// <summary>
        /// Update business partner
        /// </summary>
        /// <param name="Individual"></param>
        /// <returns></returns>
        public IndividualResponse Update(IndividualViewModel Individual)
        {
            IndividualResponse response = new IndividualResponse();

            try
            {
                response         = WpfApiHandler.SendToApi <IndividualViewModel, IndividualResponse>(Individual, "Update");
                response.Success = true;
            }
            catch (Exception ex)
            {
                response.Success = false;
                response.Message = ex.Message;
            }

            return(response);
        }
        /// <summary>
        /// Deactivate business partner by id
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public IndividualResponse Delete(int id)
        {
            IndividualResponse response = new IndividualResponse();

            try
            {
                IndividualViewModel viewModel = new IndividualViewModel();
                viewModel.Id     = id;
                response         = WpfApiHandler.SendToApi <IndividualViewModel, IndividualResponse>(viewModel, "Delete");
                response.Success = true;
            }
            catch (Exception ex)
            {
                response.Success = false;
                response.Message = ex.Message;
            }

            return(response);
        }
        /// <summary>
        /// Get single active business partner for selected company
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public IndividualResponse GetIndividual(int id)
        {
            IndividualResponse response = new IndividualResponse();

            try
            {
                response = WpfApiHandler.GetFromApi <IndividualViewModel, IndividualResponse>("GetIndividual", new Dictionary <string, string>()
                {
                    { "id", id.ToString() },
                });
            }
            catch (Exception ex)
            {
                response.Success = false;
                response.Message = ex.Message;
            }

            return(response);
        }
        /// <summary>
        /// Get single active business partner for selected company
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public IndividualResponse GetIndividual(int id)
        {
            IndividualResponse response = new IndividualResponse();

            try
            {
                response.Individual = unitOfWork.GetIndividualsRepository()
                                      .GetIndividual(id)
                                      .ConvertToIndividualViewModel();
                response.Success = true;
            }
            catch (Exception ex)
            {
                response.Individual = new IndividualViewModel();
                response.Success    = false;
                response.Message    = ex.Message;
            }

            return(response);
        }
        private void btnDelete_Click(object sender, RoutedEventArgs e)
        {
            // Check if any data is selected for delete
            if (CurrentIndividual == null)
            {
                MainWindow.ErrorMessage = ("Morate odabrati radnika za brisanje!");
                return;
            }

            // Show blur effects
            SirmiumERPVisualEffects.AddEffectOnDialogShow(this);

            // Create confirmation window
            DeleteConfirmation deleteConfirmationForm = new DeleteConfirmation("radnika", CurrentIndividual.Name);

            var showDialog = deleteConfirmationForm.ShowDialog();

            if (showDialog != null && showDialog.Value)
            {
                // Delete business partner
                IndividualResponse response = individualService.Delete(CurrentIndividual.Id);

                // Display data and notifications
                if (response.Success)
                {
                    MainWindow.SuccessMessage = ("Podaci su uspešno obrisani!");
                    Thread displayThread = new Thread(() => PopulateData());
                    displayThread.IsBackground = true;
                    displayThread.Start();
                }
                else
                {
                    MainWindow.ErrorMessage = (response.Message);
                }
            }

            // Remove blur effects
            SirmiumERPVisualEffects.RemoveEffectOnDialogShow(this);

            dgIndividuals.Focus();
        }