public Result CreateCompany(WebCCApi.Company webccCompany)
        {
            Result result = new Result();

            try
            {
                if (String.IsNullOrWhiteSpace(webccCompany.Address1)) webccCompany.Address1 = "";
                if (String.IsNullOrWhiteSpace(webccCompany.Address2)) webccCompany.Address2 = "";
                if (String.IsNullOrWhiteSpace(webccCompany.City)) webccCompany.City = "";
                if (String.IsNullOrWhiteSpace(webccCompany.CompanyName)) webccCompany.CompanyName = "";
                if (String.IsNullOrWhiteSpace(webccCompany.ContactName)) webccCompany.ContactName = "";
                if (String.IsNullOrWhiteSpace(webccCompany.Country)) webccCompany.Country = "";
                if (String.IsNullOrWhiteSpace(webccCompany.Email)) webccCompany.Email = "";
                if (String.IsNullOrWhiteSpace(webccCompany.Fax)) webccCompany.Fax = "";
                if (String.IsNullOrWhiteSpace(webccCompany.Phone)) webccCompany.Phone = "";
                if (String.IsNullOrWhiteSpace(webccCompany.State)) webccCompany.State = "";

                WebCCApi.Service webccAPI = new WebCCApi.Service();
                string companyId = "";

                WebCCApi.Company webccCompanyCheck = null;
                string companyResult = webccAPI.GetCompany(webccCompany.CompanyName, out webccCompanyCheck);

                if (webccCompanyCheck != null) throw new Exception("Company already exists");

                companyResult = webccAPI.CreateCompany(webccCompany, out companyId);

                if (companyResult != "Success")
                {
                    throw new Exception("Create Company failed: " + companyResult);

                }
                webccCompany.Id = companyId;
                result.Results = webccCompany;
            }

            catch (Exception exception)
            {

                result.IsError = true;
                result.ReturnCode = 1;
                result.Message = exception.Message;
            }

            return result;
        }
        public Result CreateWebCCUser(ref WebCCApi.User webccUser, string clientGuid, String vault = null)
        {
            Result result = new Result();

            try
            {

                ConnectionInfo connInfo = setConnectionInfo(vault);
                WebCCApi.Service webccAPI = new WebCCApi.Service();

                webccUser.Profile.VaultName = connInfo.VaultName;
                webccUser.Profile.Address = connInfo.ExternalAddress;

                string userResult = webccAPI.CreateUser(webccUser);

                if (userResult != "Success")
                {
                    throw new Exception("Create WebCC user failed: " + userResult);

                }

            }

            catch (Exception exception)
            {
                result.IsError = true;
                result.ReturnCode = 1;
                result.Message = exception.Message;
            }

            return result;
        }
        public Result CreateWebccCompany(ref  WebCCApi.Company webccCompany, String vault = null)
        {
            Result result = new Result();

            try
            {

                WebCCApi.Service webccAPI = new WebCCApi.Service();
                string CompanyID = "";

                WebCCApi.Company webccCompanyCheck = new WebCCApi.Company();
                string companyResult = webccAPI.GetCompany(webccCompany.CompanyName, out webccCompanyCheck);

                if (webccCompany.Id != null) throw new Exception("Company already exists");

                companyResult = webccAPI.CreateCompany(webccCompany, out CompanyID);

                if (companyResult != "Success")
                {
                    throw new Exception("Create Company failed: " + companyResult);

                }
                webccCompany.Id = CompanyID;

            }

            catch (Exception exception)
            {

                result.IsError = true;
                result.ReturnCode = 1;
                result.Message = exception.Message;
            }

            return result;
        }