public async Task <IActionResult> UpdatePersonAvatar([FromForm] UserAvatarModel model)
        {
            try {
                if (ModelState.IsValid)
                {
                    var requestHeaders = HttpContext.Request.Headers;
                    int userId         = 0;
                    if (requestHeaders.TryGetValue("Authorization", out StringValues token))
                    {
                        userId = JwtService.GetUserIdFromToken(JwtService.DecodeToken(token.ToString()));
                        if (userId < 1)
                        {
                            return(Unauthorized());
                        }
                    }
                    else
                    {
                        return(Unauthorized());
                    }
                    byte[] avatarImage;
                    using (var memoryStream = new MemoryStream()) {
                        await model.AvatarImage.CopyToAsync(memoryStream);

                        avatarImage = memoryStream.ToArray();
                    }
                    string guid = Guid.NewGuid().ToString();
                    string mime = model.AvatarImage.ContentType.Contains("/") ?
                                  model.AvatarImage.ContentType.Split("/")[1] :
                                  model.AvatarImage.ContentType;
                    string fileName = $"{guid}.{mime}";
                    string realPath;
                    try {
                        realPath = _personLogic.SavePersonsAvatar(fileName, avatarImage, userId);
                    } catch (Exception e) {
                        return(StatusCode(500, e));
                    }
                    if (string.IsNullOrWhiteSpace(realPath))
                    {
                        return(BadRequest());
                    }

                    return(Ok(realPath));
                }
                else
                {
                    return(BadRequest(ModelState));
                }
            } catch (Exception e) {
                return(BadRequest(e));
            }
        }