/**
  * Update an existing DNS template. This method will overwrite the entire Template.
  *
  * ### Request: ###
  *
  * ~~~
  * {
  *     "identifier": <string>,
  *     "description": <string>,
  *     "entries": [ {
  *            "name": <string>,
  *            "type": <string>,
  *            "content": <string>,
  *            "ttl": <int optional>,
  *            "priority": <int optional>
  *     },0..n ]
  * }
  * ~~~
  *
  * ### Response: ###
  *
  * ~~~
  * true
  * ~~~
  *
  * ### Errors: ###
  *
  * * 508 - Invalid request, missing required parameters or input validation failed.
  * * 500 - Failed to connect to database or query execution error.
  * * 404 - Could not find template.
  *
  * @access public
  * @param mixed $request Request parameters
  * @param string $identifier Template 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) {
         $response->code = Response::BADREQUEST;
         $response->error = "Request body was malformed. Ensure the body is in valid format.";
         $response->error_detail = "BODY_MALFORMED";
         return $response;
     }
     if (empty($identifier) || !isset($data->identifier) || !isset($data->entries) || empty($data->entries)) {
         $response->code = Response::BADREQUEST;
         $response->error = "Identifier and/or entries were missing or invalid. Ensure that the body is in valid format and all required parameters are present.";
         $response->error_detail = "MISSING_REQUIRED_PARAMETERS";
         return $response;
     }
     $validator = new TemplateValidator($data);
     if (!$validator->validates()) {
         $response->code = Response::BADREQUEST;
         $response->error = $validator->getFormattedErrors();
         $response->error_detail = $validator->getErrorDetails();
         return $response;
     }
     return TemplateFunctions::modify_template($response, $identifier, $data);
 }