public async Task <IActionResult> Create([FromBody] InitiativeDto initiativeDto) { if (initiativeDto == null) { logger.LogError("Input object cannot be null"); return(new BadRequestObjectResult(new { error = "Input object cannot be null" })); } if (String.IsNullOrEmpty(initiativeDto.Name) || String.IsNullOrEmpty(initiativeDto.Description)) { logger.LogError("Some fields are null"); return(new BadRequestObjectResult(new { error = "Some fields are null" })); } try { var result = await initiativeService.CreateNewInitiative(initiativeDto); return(Ok(result)); }catch (Exception ex) { logger.LogError(ex, ex.Message); return(BadRequest($"Module not saved, {ex.Message}")); } }