public IActionResult Create([FromBody] Volunteer volunteerIn, string userId) { Volunteer volunteerToCreate = _volunteersService.Create(volunteerIn); _logger.LogInformation($"Trying to add volunteer {volunteerToCreate.Id} to user {userId}"); var addVolunteerIdToUser = _usersService.AddVolunteerIdToUser(volunteerToCreate.Id, userId); if (addVolunteerIdToUser) { _logger.LogInformation("Volunteer ID added to user successfully."); } else { _logger.LogError("Volunteer ID not added to user"); } _logger.LogInformation($"Trying to add userId {userId} to volunteer {volunteerToCreate.Id}"); var addUserIdToVolunteer = _volunteersService.AddUserIdToVolunteerRecord(volunteerToCreate.Id, userId); if (addUserIdToVolunteer) { _logger.LogInformation("User ID added to volunteer successfully."); } else { _logger.LogError("User ID not added to volunteer"); } return(CreatedAtRoute( routeName: "GetvolunteerById", routeValues: new { id = volunteerToCreate.Id.ToString() }, value: volunteerToCreate)); }