public static object Share(IDictionary <string, string> diagram) { DiagramService service = (DiagramService) new ServiceLocator <Attachment>().locate(); var stories = new List <UserStoryAttachment>(); IEnumerable <string> storiesStr = !string.IsNullOrEmpty(diagram["userStories"]) ? diagram["userStories"].Split(',') : Enumerable.Empty <string>(); storiesStr.ToList().ForEach(f => { stories.Add(new UserStoryAttachment() { userStoryId = int.Parse(f), attachId = int.Parse(diagram["attachId"]) }); }); var diagramObject = new Attachment() { Id = int.Parse(diagram["attachId"]), UserStoryAttachments = stories }; service.Share(diagramObject, int.Parse(diagram["userStoryId"]), new List().GetUserId()); return(Utils.SerializeObject(stories)); }