public bool AddEmployee(int employeeId, int companyId)
        {
            List<string> errors = new List<string>();
            var employee = _empRepository.GetEmployeeById(employeeId);

            if (employee != null && employee.CompanyId != 0)
            {
                if (employee.CompanyId != companyId)
                {
                    errors.Add("Person is already an employee of another company.");
                }
            }
            if (errors.Count != 0)
            {
                var e = new ValidationException("A validation error has occured.", errors);
                throw e;
            }

               if( _empRepository.AddPersonToCompany(employeeId, companyId) != null)
               {
               return true;
               }
               else
               {
               return false;
               }
        }
 public DataAccess.DataContracts.ICompany CreateCompany(DataAccess.DataContracts.ICompany company)
 {
     CompanyValidator validator = new CompanyValidator();
     List<string> errors = new List<string>();
     errors = validator.validateCompany(company);
     if(errors.Count == 0)
     {
         return _repository.AddCompany(company);
     }
     else
     {
         var e = new ValidationException("A validation error has occured.", errors);
         throw e;
     }
 }
        public DataAccess.DataContracts.ICompany DeleteCompany(int companyId)
        {
            List<string> errors = new List<string>();

            if(_projectRepository.GetProjectsForCompanyId(companyId).Count != 0)
            {
                errors.Add("Cannot delete because one or more projects are associated with this company.");
            }
            if (_empRepository.GetAllEmployeeIds(companyId).Count != 0)
            {
                errors.Add("Cannot delete because one or more employees are associated with this company.");
            }
            if (errors.Count == 0)
            {
                var deletedCompany = _repository.GetCompanyById(companyId);
                if (deletedCompany != null)
                {
                    _repository.DeleteCompany(companyId);
                }
                return deletedCompany;
            }
            else
            {
                var e = new ValidationException("A validation error has occured.", errors);
                throw e;
            }
        }