public IActionResult EditProfile([FromBody] Profile profile) { try { if (profile.UserId == IdentityHelper.GetUserId(HttpContext)) { // Current user has access to this profile _profileRepository.EditProfile(profile); return(Ok()); } else { // Current user does not have access to this profile return(Unauthorized()); } } catch { return(NotFound()); } }