/// <summary>
 /// Find Command by ID
 /// </summary>
 /// <param name="id">Command ID</param>
 /// <returns>Command object</returns>
 public DeviceCommand Find(long id)
 {
     DeviceCommand cmd = new DeviceCommand();
     List<DeviceCommand> cmds = db.DeviceCommands.Where(l => l.ID == id).ToList();
     if (cmds.Count == 1)
     {
         cmd = cmds[0];
     }
     else
     {
         throw new Exception("Not Found");
     }
     return cmd;
 }
 public ResultInfo.Result Add(string title, long deviceID, string description, string commandCode, string ownerID)
 {
     try
     {
         DeviceCommand cmd = new DeviceCommand();
         cmd.Title = title;
         cmd.DeviceID = deviceID;
         cmd.Description = description;
         cmd.CommandCode = commandCode;
         cmd.OwnerID = ownerID;
         db.DeviceCommands.Add(cmd);
         db.SaveChanges();
         return ResultInfo.GenerateOKResult("Saved", cmd.ID);
     }
     catch
     {
         return ResultInfo.GetResultByID(1);
     }
 }