public Group CreateGroup(User user, GroupModel model) { var countGroupToday = user.CreatedEventId .Select(id => _groupService.GetById(id)) .Count(e => e.CreatedTIme > DateTime.Today.AddDays(-1)); if (countGroupToday >= 10) { return(null); } var group = new Group() { Name = model.Name, Description = model.Description, CreatedTIme = DateTime.Now, OwnerId = user.Id, Picture = model.Picture }; _groupStorage.Save(group); return(group); }