static async Task MainAsync(IRepository<SampleEntity> repo)
        {
            foreach (var s in await repo.GetAllAsync())
            {
                Console.WriteLine("{0} | {1}", s.ID, s.Name);
            }

            // Paged Set //
            Console.WriteLine("\nPage = 2 - Page Size = 2 :");
            var some = await repo.GetAsync(2, 2, s => s.ID);
            foreach (var s in some)
            {
                Console.WriteLine("{0} | {1}", s.ID, s.Name);
            }
                
            // Updating //
            var fox = await repo.FindAsync(e => e.Name == "Fox");
            fox.Name = "Dog";

            repo.Update(fox, fox.ID);

            // Deleting //
            Console.WriteLine("\n " + await repo.DeleteAsync(repo.Get(5)) + "\n");

            foreach (var e in repo.GetAll())
                Console.WriteLine(e.ID + " | " + e.Name);
        }
        public async Task CancelAsync(IRepository<EventRegistration> repository)
        {
            if (repository == null) { throw new ArgumentNullException("repository"); }

            if (Event.IsInPast())
            {
                throw new UserFriendlyException("Can not cancel event which is in the past!"); //TODO: Localize
            }

            if (Event.IsAllowedCancellationTimeEnded())
            {
                throw new UserFriendlyException("It's too late to cancel your registration!"); //TODO: Localize
            }

            await repository.DeleteAsync(this);
        }