// Add the request to be ignored for future warnings, it requires further confimation
func AddIgnoreList(entity models.Ignore_List, w http.ResponseWriter, enc Encoder, db gorp.SqlExecutor) (int, string) {

	if isInvalidIgnoreList(&entity) {
		return http.StatusBadRequest, Must(enc.EncodeOne(entity))
	}

	status := &models.DefaultStruct{
		Id:       http.StatusOK,
		Name:     messages.GetLocaleMessage(entity.Lang_key, "MSG_CONFIRM_IGNOREME"),
		Lang_key: entity.Lang_key,
		Type:     models.MSG_TYPE_IGNORE,
	}

	if MoreThanTwoRequestByIp(db, &entity) {
		status = &models.DefaultStruct{
			Id:       http.StatusBadRequest,
			Name:     messages.GetLocaleMessage(entity.Lang_key, "MSG_TOO_MANY_IGNOREME_REQUESTS"),
			Lang_key: entity.Lang_key,
			Type:     models.MSG_TYPE_IGNORE,
		}
		return http.StatusUnauthorized, Must(enc.EncodeOne(status))
	}

	ingnored := InIgnoreList(db, entity.Contact)

	if ingnored != nil && ingnored.Confirmed {

		status = &models.DefaultStruct{
			Id:       http.StatusBadRequest,
			Name:     messages.GetLocaleMessage(entity.Lang_key, "MSG_CONTACT_ALREADY_IGNORED"),
			Lang_key: entity.Lang_key,
		}

		return http.StatusUnauthorized, Must(enc.EncodeOne(status))

	} else if ingnored != nil {
		status = &models.DefaultStruct{
			Id:       http.StatusBadRequest,
			Name:     messages.GetLocaleMessage(entity.Lang_key, "MSG_IGNORE_REQUEST_EXISTS"),
			Lang_key: entity.Lang_key,
		}

		return http.StatusUnauthorized, Must(enc.EncodeOne(status))
	}

	rand.Seed(time.Now().UTC().UnixNano())
	entity.Created_by = "user"
	entity.Confirmed = false
	entity.Confirmation_code = randomString(6)

	errIns := db.Insert(&entity)
	checkErr(errIns, "INSERT IGNORE FAIL")

	if strings.Contains(entity.Contact, "@") {
		status.Name += " via e-mail."
		go SendEmailIgnoreme(&entity, db)
	} else if strings.Contains(entity.Contact, "+55") {
		status.Name += " via SMS."
		go sendSMSIgnoreme(&entity, db)
	}

	//w.Header().Set("Location", fmt.Sprintf("/warnabroda/ignore-list/%d", entity.Id))
	return http.StatusCreated, Must(enc.EncodeOne(status))
}