public async Task CleanReservations(string viewKey)
        {
            ServiceContext.AssertSuperuser();

            // Make sure deleted reservations are at least 12 hours old.
            var cutoff = DateTime.Now.AddHours(-12);

            var reservations = from r in ServiceContext.PortfolioContext.ProjectReservations
                               join p in ServiceContext.PortfolioContext.Projects on r.Id equals p.ProjectReservation_Id into pr
                               from ur in pr.DefaultIfEmpty()
                               where ur == null && r.ReservedAt < cutoff
                               select r;

            ServiceContext.PortfolioContext.ProjectReservations.RemoveRange(await reservations.ToListAsync());
            await ServiceContext.PortfolioContext.SaveChangesAsync();
        }
        public async Task CreateUser(string userName, string passwordHash, string accessGroupViewKey)
        {
            // Only allow this for a fresh platform or superusers...
            var context = ServiceContext.PortfolioContext;

            if (context.Users.Count() > 0)
            {
                ServiceContext.AssertSuperuser();
            }
            var accessGroup = await context.AccessGroups.SingleAsync(ag => ag.ViewKey == accessGroupViewKey);

            var user = new User()
            {
                Timestamp    = DateTime.Now,
                UserName     = userName,
                PasswordHash = passwordHash,
                AccessGroup  = accessGroup
            };

            context.Users.Add(user);
            await context.SaveChangesAsync();
        }