public async Task<ValidationResult> UpdateCalendar(CalendarDTO model)
        {
            try
            {
                //Parse guid
                Guid? guid = ParseGuid(model.Id);
                if (guid == null) return Result;

                //Find calendar in db
                var calendar = await _calendarRepo.GetByIdAsync(guid.Value);

                if (calendar == null)
                {
                    Result.Error = "Calendar not found!";
                    return Result;
                }

                calendar.ColourId = model.ColourId;
                calendar.Description = model.Description;
                calendar.Name = model.Name;

                _calendarRepo.Update(calendar);
                await SaveChangesAsync();

                Result.Success = true;
                return Result;
            }
            catch (Exception ex)
            {
                Result.Error = ex.Message;
                return Result;
            }
        }
        public async Task<bool> CreateCalendar(CalendarDTO dto)
        {
            try
            {
                //Parse guid
                Guid? guid = ParseGuid(dto.Id);
                if (guid == null) return false;

                Calendar calendar = new Calendar
                {
                    Id = guid.Value,
                    Name = dto.Name,
                    Description = dto.Description,
                    OwnerId = dto.OwnerId,
                    ColourId = dto.ColourId
                };
                
                //Add creator as a member of the calendar
                calendar.Members.Add(new CalendarMember
                {
                    UserId = calendar.OwnerId
                });

                _calendarRepo.Insert(calendar);
                await SaveChangesAsync();

                return true;
            }
            catch (Exception)
            {
                return false;
            }
        }
        public async Task<IHttpActionResult> Update(CalendarDTO calendar)
        {
            if (!ModelState.IsValid) { return BadRequest(ModelState); }

            var result = await _calendarService.UpdateCalendar(calendar);

            if (result.Success)
            {
                return Ok();
            }

            return BadRequest(result.Error);
        }
        public async Task<IHttpActionResult> Create(CalendarDTO calendar)
        {
            if (!ModelState.IsValid) { return BadRequest(ModelState); }

            var success = await _calendarService.CreateCalendar(calendar);

            if (success)
            {
                return Ok();
            }

            return BadRequest("Unable to create the new calendar");
        }