/// <summary>
        /// Adds a <seealso cref="PrescriptionModels.Medication"/> to the repository
        /// </summary>
        /// <param name="medication">
        /// The <seealso cref="PrescriptionModels.Medication"/> to add.
        /// </param>
        /// <param name="identity">
        /// The identity of the user authorized to add the <seealso cref="PrescriptionModels.Medication"/>
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// Thrown if the <paramref name="medication"/> parameter is null
        /// </exception>
        /// <exception cref="ArgumentNullException">
        /// Thrown if the <paramref name="identity"/> parameter is null
        /// </exception>
        /// <exception cref="SecurityException">
        /// Thrown if the user is not authorized to add the <seealso cref="PrescriptionModels.Medication"/>
        /// to the repository
        /// </exception>
        public void CreateMedication(PrescriptionModels.Medication medication, IIdentity identity)
        {
            logger.EnterMethod("CreateMedication");

            Invariant.IsNotNull(medication, "medication");
            Invariant.IsNotNull(identity, "identity");

            try
            {
                var user = Membership.GetUser(identity.Name, false);
                var accountReadRepository = kernel.Get<IReadOnlyRepository<AccountModels.Account>>();
                var userAccount = accountReadRepository.FindBy(account => account.UserId.Value.Equals((Guid)user.ProviderUserKey));

                medication.AccountId = userAccount.Id;

                medicationRepository.Add(medication);
            }
            catch (Exception exception)
            {
                logger.LogException(exception);
                throw;
            }

            logger.LeaveMethod("CreateMedication");
        }
        /// <summary>
        /// Updates a <seealso cref="PrescriptionModels.Medication"/> in the repository
        /// </summary>
        /// <param name="medication">
        /// The <seealso cref="PrescriptionModels.Medication"/> to update in the repository
        /// </param>
        /// <param name="identity">
        /// The <c>IIdentity</c> of the user authorized to update the 
        /// <seealso cref="PrescriptionModels.Medication"/> in the repository
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// Thrown if the <paramref name="medication"/> parameter is null
        /// </exception>
        /// <exception cref="ArgumentNullException">
        /// Thrown if the <paramref name="identity"/> parameter is null
        /// </exception>
        /// <exception cref="SecurityException">
        /// Thrown if the user is not authorized to update the <seealso cref="PrescriptionModels.Medication"/>
        /// in the repository
        /// </exception>
        public void UpdateMedication(PrescriptionModels.Medication medication, IIdentity identity)
        {
            logger.EnterMethod("UpdateMedication");

            Invariant.IsNotNull(medication, "medication");
            Invariant.IsNotNull(identity, "identity");

            try
            {
                kernel.Get<Security>().AuthorizeAction(identity, medication.AccountId);
            }
            catch (SecurityException exception)
            {
                logger.LogExceptionWithMessage(exception, "SecurityException thrown in UpdateMedication");
                throw;
            }

            try
            {
                medicationRepository.Update(medication);
            }
            catch (ArgumentException exception)
            {
                logger.LogException(exception);
                throw;
            }

            logger.LeaveMethod("UpdateMedication");
        }
        /// <summary>
        /// Updates an <seealso cref="PrescriptionModels.PrescriptionPickup"/> in the repository
        /// </summary>
        /// <param name="prescriptionPickup">
        /// The <seealso cref="PrescriptionModels.PrescriptionPickup"/> to update in the repository
        /// </param>
        /// <param name="identity">
        /// The <c>IIdentity</c> of the user authorized to update the 
        /// <seealso cref="PrescriptionModels.PrescriptionPickup"/> in the repository
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// Thrown if the <paramref name="prescriptionPickup"/> parameter is null
        /// </exception>
        /// <exception cref="ArgumentNullException">
        /// Thrown if the <paramref name="identity"/> parameter is null
        /// </exception>
        /// <exception cref="SecurityException">
        /// Thrown if the user is not authorized to update the <seealso cref="PrescriptionModels.PrescriptionPickup"/>
        /// in the repository
        /// </exception>
        public void UpdatePrescriptionPickup(PrescriptionModels.PrescriptionPickup prescriptionPickup, IIdentity identity)
        {
            logger.EnterMethod("UpdatePrescriptionPickup");

            Invariant.IsNotNull(prescriptionPickup, "prescriptionPickup");
            Invariant.IsNotNull(identity, "identity");

            try
            {
                kernel.Get<Security>().AuthorizeAction(identity, prescriptionPickup.AccountId);
            }
            catch (SecurityException exception)
            {
                logger.LogExceptionWithMessage(exception, "SecurityException thrown in UpdatePrescriptionPickup");
                throw;
            }

            try
            {
                prescriptionPickupRepository.Update(prescriptionPickup);
            }
            catch (ArgumentException exception)
            {
                logger.LogException(exception);
                throw;
            }

            logger.LeaveMethod("UpdatePrescriptionPickup");
        }