private string _handleItemMessage(string[] sections) { string response = null; ItemDefinition def; int romId; switch (sections[1]) { case "SAVE": def = new ItemDefinition(sections[2], 2); ItemDefinition match = _itemRepository.GetByRomId(def.RomId); if (match != null) { match.Name = def.Name; match.ItemType = def.ItemType; match.ItemSubType = def.ItemSubType; match.ItemSubSubType = def.ItemSubSubType; match.Value = def.Value; _itemRepository.UpdateItem(match); } else { _itemRepository.AddItem(def); } break; case "DELETE": romId = Convert.ToInt32(sections[2]); _itemRepository.DeleteItem(romId); break; case "GET": romId = Convert.ToInt32(sections[2]); def = _itemRepository.GetByRomId(romId); if (def != null) { response = def.ToDelimitedString(1); } else { response = ItemDefinition.GetNullDefinitionString(1); } break; case "FIND": switch (sections[2]) { case "NAME": string name = sections[3]; def = _itemRepository.Get(name); if (def != null) { response = def.ToDelimitedString(1); } else { response = ItemDefinition.GetNullDefinitionString(1); } break; } break; } return(response); }