public IActionResult Create([FromBody] CustomDayVM customDayVM) { string userId = customDayVM.UserId; if (customDayVM == null) { return(new BadRequestObjectResult(new { message = "Please provide a valid CustomDayVM" })); } if (userId == null || userId == "") { return(new BadRequestObjectResult(new { message = "Please provide a UserId." })); } Guid userGuid; bool success = Guid.TryParse(userId, out userGuid); if (success) { return(new OkObjectResult(customDayRepo.CreateCustomDay(customDayVM))); } return(new BadRequestObjectResult(new { message = "UserId could not be parsed as a Guid" })); }