public bool OccupyBed(Bed bed, Occupation occupation) { if (CheckIfOccupationDatesAreValid(occupation)) { Bed bedForOccupation = bedRepository.GetObject(bed.BedId); if (!CheckIfOccupationsOverlap(bedForOccupation, occupation)) { bedForOccupation.AddOccupation(occupation); bedRepository.Update(bedForOccupation); return(true); } return(false); } return(false); }