public void Save(DTO.Macro item)
        {
            using (var sqlMacro = new DataLayer.RemoteHelperDataContext())
            {
                if (item.Id.HasValue)
                {
                    var items_to_delete = (from itms in sqlMacro.MacroSteps
                                           where itms.MacroId == item.Id
                                           select itms);
                    foreach (var item_to_delete in items_to_delete)
                    {
                        sqlMacro.MacroSteps.DeleteOnSubmit(item_to_delete);
                    }
                    
                }

                if (item.Steps != null && item.Steps.Count > 0)
                    foreach (var item_to_insert in item.Steps)
                    {
                        var tmp = new DataLayer.MacroStep
                        {
                            CommandLine = null,
                            SequenceNumber = item_to_insert.SequenceNumber
                        };                        
                        
                        sqlMacro.MacroSteps.InsertOnSubmit(tmp);
                    }

                sqlMacro.SubmitChanges();
            }
        }
        public IQueryable<DTO.Macro> Read(int? id = null)
        {
                var sqlMacro = new DataLayer.RemoteHelperDataContext();
                var items = (from mcr in sqlMacro.Macros
                             //where id.HasValue == false || (id.HasValue && mcr.MacroId == id.Value)
                             select new DTO.Macro
                             {
                                 Name = mcr.MacroName,
                                 IconText = HexToChar(mcr.IconText).ToString(),
                                 Steps = (
                                     from mcrs in sqlMacro.MacroSteps
                                     where mcrs.MacroId == mcr.MacroId
                                     select new DTO.MacroStep { SequenceNumber = mcrs.SequenceNumber, IsMouseClick = mcrs.MouseClickYesNo }

                                     ).ToList()
                             });

                return items;         
        }