public bool SendChangeEmployeeSalaryRequest(SalaryProperties populateProperties)
        {
            int empId;
            int.TryParse(populateProperties.EmployeeId, out empId);
            var request = new ChangeEmployeeSalaryRequest(empId)
            {
                Properties = populateProperties
            };

            var response = this.employeeService.ChangeSalary(request);
            if (response != null && response.Exception == null)
            {
                MessageBox.Show("Success");
                return true;
            }
            else if (response != null)
            {
                MessageBox.Show(response.Exception.ToString());
            }
            return false;
        }
        public ChangeEmployeeSalaryResponse ChangeSalary(ChangeEmployeeSalaryRequest request)
        {
            var response = new ChangeEmployeeSalaryResponse();

            int empId;
            if (int.TryParse(request.Properties.EmployeeId, out empId))
            {

                try
                {

                    var employee = this.employeeRepository.FindById(empId);
                    var newSalary = this.AssignAvailablePropertiesToDomain(request.Properties, employee);

                    var brokenRules = newSalary.GetBrokenRules().ToList();

                    if (!brokenRules.Any())
                    {
                        var previousSalary = employee.Salaries.OrderByDescending(a => a.PersistenceId).FirstOrDefault();
                        if (previousSalary != null && previousSalary.UpdateFromDate(newSalary))
                        {
                            employee.AddSalary(newSalary);
                        }
                        else
                        {
                            response.Exception = new ArgumentOutOfRangeException(nameof(Salary.FromDate), "The From Date cannot be earlier the previous from date");

                        }
                        if(previousSalary == null)
                        {
                            employee.AddSalary(newSalary);
                        }

                        this.employeeRepository.Save();
                    }
                    else
                    {
                        var sb = new StringBuilder();
                        sb.AppendLine("The Salary could not be added.");
                        foreach (var rule in brokenRules)
                        {
                            sb.AppendLine(rule.RuleDescription);
                        }
                        response.Exception = new ResourceNotFoundException("The salary could not be added.");
                    }

                }
                catch (Exception ex)
                {
                    response.Exception = ex;
                }

            }
            else
            {
                response.Exception =
                    new ResourceNotFoundException(string.Format("The requested Employee Id is not valid. '{0}'",
                        request.Properties.EmployeeId));
            }
            return response;
        }