public static void GetCategoryFromTempSelectedIndex()
 {
     while (WPFDbContext.Instance.TempSelectedCategoryIndex > WPFDbContext.Instance.Categories.Count - 1)
     {
         WPFDbContext.Instance.TempSelectedCategoryIndex--;
     }
     WPFDbContext.Instance.SelectedCategory = CategoryDao.GetCategoryFromIndex(WPFDbContext.Instance.TempSelectedCategoryIndex);
 }
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            int index = (int)value;

            if (index == -1)
            {
                return(null);
            }
            return(CategoryDao.GetCategoryFromIndex(index));
        }