public IActionResult CreateNewActvity([FromBody] CreateActivityRequest requestModel) { try { var validationResult = requestModel.Validate(); if (validationResult.Any()) { return(BadRequest(validationResult)); } CreateNewActivity newActivityModel = new CreateNewActivity() { ActivityName = requestModel.ActivityName, ActivityType = requestModel.ActivityType, Message = requestModel.Message, ResourceType = requestModel.ResourceType }; var activityId = MongoConnector.CreateNewActivity(newActivityModel); return(Ok($"ActivityId:{activityId}")); } catch (Exception ex) { return(StatusCode(500, ex.Message)); } }