public genericResponse SaveCompany(TBL_COMPANIES _company)
        {
            genericResponse _response;
            try
            {
                int companiesId = _company.COMPANIESID;
                _company.IsActive = true;

                if (!VerifyCompanyRequiredFields(_company))
                    throw new Exception("Company required fields are not submiited");

                if (companiesId > 0)
                {
                    //Update Operation
                    _company.UpdatedBy = CurrentUser.UserId.ToString();
                    _company.UpdatedDate = DateTime.Now;
                    companiesId = uow.CompanyRepository().UpdateCompany(_company);
                }
                else
                {
                    List<CompanyView> companies = uow.CompanyRepository().Get("", "COMPANYNAME ASC", 0, 0,null, CurrentUser.FranchiseeID, false).ToList().Where(r => r.COMPANYNAME == _company.COMPANYNAME).ToList<CompanyView>();

                    if (companies.Count > 0)
                    {
                        _response = new genericResponse() { success = false, UniqueId = companies[0].COMPANIESID };
                        return _response;
                    }
                    //Add Operation
                    _company.CreatedDate = DateTime.Now;
                    _company.CreatedBy = CurrentUser.UserId.ToString();
                    companiesId = uow.CompanyRepository().AddCompany(_company);
                }
                uow.Save();
                //We will send back the companiesId - Either newly created or from Updated record
                _response = new genericResponse() { success = true, UniqueId = companiesId };
                return _response;
            }
            catch (Exception ex)
            {
                //_response = new genericResponse() { success = false, message = "There is a problem in Saving Company Information. Please try again later." };
                //return _response;
                throw new Exception("There is a problem in Saving Company Information. Please try again later.", ex);
            }
        }
 private bool VerifyCompanyRequiredFields(TBL_COMPANIES company)
 {
     return (!string.IsNullOrEmpty(company.COMPANYNAME) && !string.IsNullOrEmpty(company.POCFirstName) && !string.IsNullOrEmpty(company.POCLastName) && company.IndustryId > 0);
 }