public HttpResponseMessage PostAddComment(CommentModel comment, int albumId, string sessionKey) { try { var userService = new UserService(); var user = userService.GetUserBySessionKey(sessionKey); Validator.ValidateUser(user, USER_ACCESS_DENIED); var albumService = new AlbumService(); var album = albumService.GetAlbumById(albumId); Validator.ValidateAlbum(album, ALBUM_NOT_FOUND); var newComment = albumService.AddComment(comment, album, user); var commentToReturn = new CommentModel() { CreatedAt = newComment.CreatedAt, Id = newComment.Id, Text = newComment.Text, UserName = user.UserName }; return(this.Request.CreateResponse(HttpStatusCode.Created, commentToReturn)); } catch (Exception ex) { return(this.Request.CreateResponse(HttpStatusCode.BadRequest, ex.Message)); } }