public static void Save(IDictionary <string, object> diagram) { var diagramObject = new Attachment() { name = diagram["name"].ToString() }; string[] userStoriesIds = diagram.ContainsKey("userStories") ? ((object[])diagram["userStories"]).Where(w => w != null).Select(s => s.ToString()).ToArray() : null; string graph = diagram.ContainsKey("graph") ? diagram["graph"].ToString() : null; string svg = diagram.ContainsKey("svg") ? diagram["svg"].ToString() : null; service.Add(diagramObject, userStoriesIds, graph, new New().GetUserId(), svg).ToString(); }