/**
  * Update an existing DNS zone. Also allows adding and deleting records in one transaction.
  *
  * Requires that at least one DNS Zone field be modified.
  *
  * Addition and deletion of records is optional. If specified, the requirement that at least one DNS Zone field has to be modified
  * is lifted.
  *
  * If both DNS zone modifications and record modifications are specified, the DNS zone modification is carried out first. If this fails,
  * the entire transaction will abort. If the zone type changes from MASTER or NATIVE to SLAVE, and records are specified to added or
  * deleted, this will also result in an error, because SLAVE zones are not allowed to modify records.
  *
  * ### Request: ###
  *
  * ~~~
  * {
  *     "name": <string>,
  *     "type": MASTER|SLAVE|NATIVE,
  *     "master": <ipv4 optional>,
  *     "records": [ {
  *             "name": <string>,
  *             "type": <string>,
  *             "content": <string>,
  *             "priority": <int>,
  *             "mode": add|delete       # optional, default = add
  *     },0..n ]
  * }
  * ~~~
  *
  *
  * ### Response: ###
  *
  * ~~~
  * true
  * ~~~
  *
  * ### Errors (request with identifier): ###
  *
  * * 508 - Invalid request, missing required parameters or input validation failed.
  * * 500 - Failed to connect to database or query execution error.
  * * 404 - Could not find zone.
  *
  * @access public
  * @param mixed $request Request parameters
  * @param string $identifier Zone identifier
  * @return Response True if request was successful, error message otherwise.
  */
 public function post($request, $identifier = null)
 {
     $response = new FormattedResponse($request);
     $data = $request->parseData();
     if ($data == null || empty($data)) {
         $response->code = Response::BADREQUEST;
         $response->error = "Request body was malformed. Ensure the body is in valid format, and that the body is not empty.";
         $response->error_detail = "BODY_MALFORMED";
         return $response;
     }
     if (empty($identifier)) {
         $response->code = Response::BADREQUEST;
         $response->error = "Identifier was missing or invalid. Ensure that the body is in valid format.";
         $response->error_detail = "MISSING_REQUIRED_PARAMETERS";
         return $response;
     }
     $validator = new ZoneValidator($data);
     $validator->identifier = $identifier;
     if (!$validator->validates()) {
         $response->code = Response::BADREQUEST;
         $response->error = $validator->getFormattedErrors();
         $response->error_detail = $validator->getErrorDetails();
         return $response;
     }
     return ZoneFunctions::modify_zone($response, $identifier, $data);
 }