```php
<?php

require_once '../../core/api_bootstrap.php';

$data = Request::post();

try {

Validator::required($data,[
'id',
'name'
]);

$db = new Database();
$conn = $db->connect();

$name = Helper::sanitize($data['name']);

/*
Generate slug while ignoring current ID
*/
$slug = Slug::generateUnique(
'blog_categories',
'slug',
$name,
$data['id']
);

/*
Check if new image uploaded
*/
$image = null;

if(isset($_FILES['image'])){
$image = Upload::image('image','blog-categories');
}

$query = "

UPDATE blog_categories

SET
name = :name,
slug = :slug,
meta_title = :meta_title,
meta_description = :meta_description,
schema_markup = :schema_markup
";

if($image){
$query .= ", image = :image";
}

$query .= " WHERE id = :id";

$stmt = $conn->prepare($query);

$params = [

':id'=>$data['id'],
':name'=>$name,
':slug'=>$slug,
':meta_title'=>$data['meta_title'] ?? null,
':meta_description'=>$data['meta_description'] ?? null,
':schema_markup'=>$data['schema_markup'] ?? null

];

if($image){
$params[':image']=$image;
}

$stmt->execute($params);

Logger::activity(
ApiAuth::employeeId(),
"update",
"blog_categories",
$data['id'],
ApiAuth::ip()
);

Response::success([],"Blog category updated");

}
catch(Exception $e){

Logger::log("system.log",$e->getMessage());
Response::error("Server error",500);

}