public UiSettings GetUiColoursByName(string name)
        {
            using (var ctx = new StudentTrackerDbContext())
            {
                UiSettings settings = new UiSettings { BackgroundColour = "#ffffff", HeaderColour = "#101010" };

                if (!ctx.Users.Any(x=>x.UserName==name))
                {
                    throw new InvalidOperationException("No user with specified name found.");
                }
                else
                {
                    var user = ctx.Users.Single(x=>x.UserName==name);
                    var uiColour = user.UiColour;
                    if (uiColour != null)
                    {
                        settings.BackgroundColour = string.IsNullOrEmpty(uiColour.BackgroundColour) ? "#ffffff" : uiColour.BackgroundColour;
                        settings.HeaderColour = string.IsNullOrEmpty(uiColour.HeaderColour) ? "#101010" : uiColour.HeaderColour;
                    }
                }
                return settings;
            }
        }
 public UiSettings GetUiColours(string id)
 {
     using (var ctx = new StudentTrackerDbContext())
     {
         UiSettings settings = new UiSettings { BackgroundColour = "#ffffff", HeaderColour = "#101010" };
         var user = ctx.Users.Find(id);
         if (user == null)
         {
             throw new InvalidOperationException("No user with specified id found.");
         }
         var uiColour = user.UiColour;
         if (uiColour != null)
         {
             settings.BackgroundColour = string.IsNullOrEmpty(uiColour.BackgroundColour) ? "#ffffff" : uiColour.BackgroundColour;
             settings.HeaderColour = string.IsNullOrEmpty(uiColour.HeaderColour) ? "#101010" : uiColour.HeaderColour;
         }
         return settings;
     }
 }