//CreateHouseholdForTeams
        private Household CreateHousehold(List <Contact> contacts)
        {
            Household result = new Household();
            Dictionary <long, long> contactDic = new Dictionary <long, long>();
            string hhName = "Client Household";
            //Get next householdid
            long householdId = Convert.ToInt64(_dbWrapper.ExecuteScalar(cmd =>
            {
                cmd.CommandText = SqlConstants.GET_NEXT_SEQUENCE_HOUSEHOLDID;
            }, _context.Identity.InstitutionId));


            //calcualte the household name from the primary contact details
            foreach (Contact cp in contacts)
            {
                if (cp.RelationShipType == RelationShipType.HEAD)
                {
                    hhName = cp.FirstName + " " + cp.LastName;
                    //name = hhName.Trim();
                    break;
                }
            }

            var executeResult = _dbWrapper.Execute(cmd =>
            {
                cmd.CommandText = SqlConstants.CREATE_HOUSEHOLD;
                DatabaseWrapperHelper.AddInIntParameter(cmd, "householdId", householdId.ToString());
                DatabaseWrapperHelper.AddInStringParameter(cmd, "householdName", hhName);
                DatabaseWrapperHelper.AddInIntParameter(cmd, "householdTypeId", ((int)HouseholdType.PROSPECT).ToString());
            }, _context.Identity.InstitutionId);

            // insert into web_investor
            foreach (Contact contact in contacts)
            {
                CreateContact(contact, householdId);
            }

            result.HouseholdID = householdId.ToString();
            result.Name        = hhName;
            result.Type        = "PROSPECT";
            result.Persons     = contacts;
            return(result);
        }
        public bool IsBackOfficeInstitution()
        {
            int configId = Convert.ToInt32(_dbWrapper.ExecuteScalar(cmd =>
            {
                cmd.CommandText = SqlConstants.GET_INSTITUTION_CONFIG;
                DatabaseWrapperHelper.AddInIntParameter(cmd, "InstitutionId", _context.Identity.InstitutionId);
            }, _context.Identity.InstitutionId));

            return(configId == Constants.IDS_BACKOFFICE_CONFIG_ID);
        }