def update_master_address
      @agency = Agency.last
      if @agency.primary_address
        @agency.primary_address.update(address_params)
        @agency.primary_address.save!
      else
        primary_address = Address.create(address_params)
        @agency.primary_address_id = primary_address.id
        @agency.save!
        # @agency.primary_address = Address.create(address_params)
      end
      render json: @agency.primary_address
    end
def update_master_address
      @agency = Agency.last
      if @agency.primary_address
        @agency.primary_address.update(address_params)
        @agency.primary_address.save!
      else
        primary_address = Address.create(address_params)
        @agency.primary_address_id = primary_address.id
        @agency.save!
        # @agency.primary_address = Address.create(address_params)
      end
      render json: @agency.primary_address
    end
def update_legacy
   @agency = Agency.last
   @agency.style_variables = params[:style_variables]
   @agency.social_media = params[:social_media]
   # ActionController::Base.helpers.sanitize_css
   # TODO - allow raw_css after sanitizing with above
   # @agency.raw_css = params[:raw_css]
   if params[:site_template_id].present?
     # TODO - verify site_template exists
     @agency.site_template_id = params[:site_template_id]
   end
   # TODO - rename supported_languages client side
   @agency.supported_locales = params[:supported_languages]
   @agency.save!
   return render json: { "success": true }, status: :ok, head: :no_content
 end