public IHttpActionResult SaveBlog(BlogViewModel model) { model.CreatedBy = User.Identity.GetUserId <long>(); var blogId = _blogService.BlogInsert(model.ToModel()); var fileGroupsItem = model.FileGroupItem != null?model.FileGroupItem.ToModel() : null; if (fileGroupsItem != null) { //set target path and move file from target location fileGroupsItem = _fileGroupService.SetPathAndMoveSingleFile(fileGroupsItem, blogId); //Save list of file in our DB _fileGroupService.FileGroupItemsInsert(fileGroupsItem); } return(Ok(blogId.SuccessResponse("Blog save successfully"))); }