public CreateClusterResponse SaveCluster(CreateClusterRequest clusterRequest) { var createClusterResponse = new CreateClusterResponse(); var cluster = _messageMapper.MapToCluster(clusterRequest.Cluster); try { _clusterRepository.SaveCluster(cluster); var clusterDto = _messageMapper.MapToClusterDto(cluster); createClusterResponse.Cluster = clusterDto; createClusterResponse.Messages.Add("Successfully saved the cluster"); createClusterResponse.StatusCode = HttpStatusCode.Created; } catch (Exception e) { var error = e.ToString(); createClusterResponse.Messages.Add(error); createClusterResponse.StatusCode = HttpStatusCode.InternalServerError; } return(createClusterResponse); }